summaryrefslogtreecommitdiff
path: root/libavcodec/diracdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-12-07 00:27:08 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-12-07 02:24:14 +0100
commitb84d1bf193d2af5e06979db12ffa0dedaa6c8ea1 (patch)
treecc79144788814819163d88aeeb4cfb0a15cc153f /libavcodec/diracdec.c
parentf8d68822c0f9a0bf270691c5f85a736c1ce5719b (diff)
diracdec: fix emulated_edge condition, fix out of array reads
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/diracdec.c')
-rw-r--r--libavcodec/diracdec.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c
index 8e62391555..ef75a536ed 100644
--- a/libavcodec/diracdec.c
+++ b/libavcodec/diracdec.c
@@ -1409,8 +1409,9 @@ static int mc_subpel(DiracContext *s, DiracBlock *block, const uint8_t *src[5],
}
/* fixme: v/h _edge_pos */
- if ((unsigned)x > FFMAX(p->width +EDGE_WIDTH/2 - p->xblen, 0) ||
- (unsigned)y > FFMAX(p->height+EDGE_WIDTH/2 - p->yblen, 0)) {
+ if (x + p->xblen > p->width +EDGE_WIDTH/2 ||
+ y + p->yblen > p->height+EDGE_WIDTH/2 ||
+ x < 0 || y < 0) {
for (i = 0; i < nplanes; i++) {
ff_emulated_edge_mc(s->edge_emu_buffer[i], src[i], p->stride,
p->xblen, p->yblen, x, y,