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)
committerReinhard Tartler <siretart@tauware.de>
Sat, 12 Jan 2013 16:59:39 +0000 (17:59 +0100)
Fixes a segfault in te fuzzed sample resolutionchange.flv_s211713.

CC: libav-stable@libav.org
(cherry picked from commit 5ae72f54532960cb9eae82a1c9e8d505106c022b)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
libavcodec/flashsv.c

index c99c21c719905f440ff13c4c7ca3c88815aba89d..792ad57f88ced0cb7870a37c9ddc18d0d6463f17 100644 (file)
@@ -370,6 +370,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,