bink: fix out of reference frame read
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 2 Jun 2012 17:56:10 +0000 (19:56 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 2 Jun 2012 17:56:10 +0000 (19:56 +0200)
Fixes Ticket1374

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/bink.c

index 8a9367d..4ad2e6f 100644 (file)
@@ -1128,6 +1128,11 @@ static int bink_decode_plane(BinkContext *c, GetBitContext *gb, int plane_idx,
                 xoff = get_value(c, BINK_SRC_X_OFF);
                 yoff = get_value(c, BINK_SRC_Y_OFF);
                 ref = prev + xoff + yoff * stride;
+                if (ref < ref_start || ref > ref_end) {
+                    av_log(c->avctx, AV_LOG_ERROR, "Copy out of bounds @%d, %d\n",
+                           bx*8 + xoff, by*8 + yoff);
+                    return -1;
+                }
                 c->dsp.put_pixels_tab[1][0](dst, ref, stride, 8);
                 memset(dctblock, 0, sizeof(*dctblock) * 64);
                 dctblock[0] = get_value(c, BINK_SRC_INTER_DC);