flashsv: make sure data for zlib priming is available
authorJanne Grunau <janne-libav@jannau.net>
Wed, 28 Nov 2012 16:31:35 +0000 (17:31 +0100)
committerJanne Grunau <janne-libav@jannau.net>
Thu, 29 Nov 2012 13:15:05 +0000 (14:15 +0100)
Fixes a segfault in the fuzzed sample resolutionchange.flv_s314809.

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

index ac57f9f..d12e234 100644 (file)
@@ -401,6 +401,11 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data,
                     av_log_missing_feature(avctx, "zlibprime_curr", 1);
                     return AVERROR_PATCHWELCOME;
                 }
+                if (!s->blocks && (s->zlibprime_curr || s->zlibprime_prev)) {
+                    av_log(avctx, AV_LOG_ERROR, "no data available for zlib "
+                           "priming\n");
+                    return AVERROR_INVALIDDATA;
+                }
                 size--; // account for flags byte
             }