Handle the case where we do not have enough input
authorVitor Sessak <vitor1001@gmail.com>
Sat, 24 May 2008 16:20:37 +0000 (16:20 +0000)
committerVitor Sessak <vitor1001@gmail.com>
Sat, 24 May 2008 16:20:37 +0000 (16:20 +0000)
Originally committed as revision 13282 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/ra144.c

index 5fd2a24..5cfe94f 100644 (file)
@@ -343,9 +343,11 @@ static int ra144_decode_frame(AVCodecContext * avctx,
     Real144_internal *glob = avctx->priv_data;
     GetBitContext gb;
 
-    if(buf_size == 0)
-        return 0;
-
+    if(buf_size < 20) {
+        av_log(avctx, AV_LOG_ERROR,
+               "Frame too small (%d bytes). Truncated file?\n", buf_size);
+        return buf_size;
+    }
     init_get_bits(&gb, buf, 20 * 8);
 
     for (i=0; i<10; i++)