avcodec/fic: Check if a frame is available before using it
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 14 Aug 2014 03:32:44 +0000 (05:32 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 22 Aug 2014 00:22:31 +0000 (02:22 +0200)
Fixes null pointer dereference
Fixes: ficvf.avi
Found-by: Piotr Bandurski <ami_stuff@o2.pl>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/fic.c

index d08d240..5615e69 100644 (file)
@@ -282,8 +282,13 @@ static int fic_decode_frame(AVCodecContext *avctx, void *data,
         av_log(avctx, AV_LOG_WARNING, "Invalid FIC Header.\n");
 
     /* Is it a skip frame? */
-    if (src[17])
+    if (src[17]) {
+        if (!ctx->final_frame) {
+            av_log(avctx, AV_LOG_WARNING, "Initial frame is skipped\n");
+            return AVERROR_INVALIDDATA;
+        }
         goto skip;
+    }
 
     nslices = src[13];
     if (!nslices) {