flashsv: check for keyframe before using differential coding
authorJanne Grunau <janne-libav@jannau.net>
Sat, 24 Nov 2012 14:50:03 +0000 (15:50 +0100)
committerJanne Grunau <janne-libav@jannau.net>
Mon, 26 Nov 2012 09:26:01 +0000 (10:26 +0100)
Fixes a segfault in te fuzzed sample resolutionchange.flv_s211713.

CC: libav-stable@libav.org
libavcodec/flashsv.c

index 2ba3264..ac57f9f 100644 (file)
@@ -377,6 +377,11 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data,
                 }
 
                 if (has_diff) {
+                    if (!s->keyframe) {
+                        av_log(avctx, AV_LOG_ERROR,
+                               "inter frame without keyframe\n");
+                        return AVERROR_INVALIDDATA;
+                    }
                     s->diff_start  = get_bits(&gb, 8);
                     s->diff_height = get_bits(&gb, 8);
                     av_log(avctx, AV_LOG_DEBUG,