[FFmpeg-devel] [PATCH 1/3] Check for missing reference frames in bink decoder.

fenrir at elivagar.org fenrir at elivagar.org
Tue Sep 27 01:02:15 CEST 2011


From: Laurent Aimar <fenrir at videolan.org>

---
 libavcodec/bink.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/libavcodec/bink.c b/libavcodec/bink.c
index e137312..045cd46 100644
--- a/libavcodec/bink.c
+++ b/libavcodec/bink.c
@@ -992,6 +992,10 @@ static int bink_decode_plane(BinkContext *c, GetBitContext *gb, int plane_idx,
             }
             switch (blk) {
             case SKIP_BLOCK:
+                if (!c->last.data[0]) {
+                    av_log(c->avctx, AV_LOG_ERROR, "Missing reference frame\n");
+                    return -1;
+                }
                 c->dsp.put_pixels_tab[1][0](dst, prev, stride, 8);
                 break;
             case SCALED_BLOCK:
@@ -1055,6 +1059,10 @@ static int bink_decode_plane(BinkContext *c, GetBitContext *gb, int plane_idx,
                 prev += 8;
                 break;
             case MOTION_BLOCK:
+                if (!c->last.data[0]) {
+                    av_log(c->avctx, AV_LOG_ERROR, "Missing reference frame\n");
+                    return -1;
+                }
                 xoff = get_value(c, BINK_SRC_X_OFF);
                 yoff = get_value(c, BINK_SRC_Y_OFF);
                 ref = prev + xoff + yoff * stride;
@@ -1089,6 +1097,10 @@ static int bink_decode_plane(BinkContext *c, GetBitContext *gb, int plane_idx,
                     dst[coordmap[*scan++]] = get_value(c, BINK_SRC_COLORS);
                 break;
             case RESIDUE_BLOCK:
+                if (!c->last.data[0]) {
+                    av_log(c->avctx, AV_LOG_ERROR, "Missing reference frame\n");
+                    return -1;
+                }
                 xoff = get_value(c, BINK_SRC_X_OFF);
                 yoff = get_value(c, BINK_SRC_Y_OFF);
                 ref = prev + xoff + yoff * stride;
@@ -1114,6 +1126,10 @@ static int bink_decode_plane(BinkContext *c, GetBitContext *gb, int plane_idx,
                 c->dsp.fill_block_tab[1](dst, v, stride, 8);
                 break;
             case INTER_BLOCK:
+                if (!c->last.data[0]) {
+                    av_log(c->avctx, AV_LOG_ERROR, "Missing reference frame\n");
+                    return -1;
+                }
                 xoff = get_value(c, BINK_SRC_X_OFF);
                 yoff = get_value(c, BINK_SRC_Y_OFF);
                 ref = prev + xoff + yoff * stride;
-- 
1.7.2.5



More information about the ffmpeg-devel mailing list