avcodec/ffv1dec: Check that there is enough space for the CRC in the global header
authorMichael Niedermayer <michael@niedermayer.cc>
Wed, 2 Sep 2015 00:10:31 +0000 (02:10 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Wed, 2 Sep 2015 00:10:31 +0000 (02:10 +0200)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/ffv1dec.c

index 6c035b8..133ad85 100644 (file)
@@ -594,7 +594,7 @@ static int read_extra_header(FFV1Context *f)
         unsigned v;
         v = av_crc(av_crc_get_table(AV_CRC_32_IEEE), 0,
                    f->avctx->extradata, f->avctx->extradata_size);
-        if (v) {
+        if (v || f->avctx->extradata_size < 4) {
             av_log(f->avctx, AV_LOG_ERROR, "CRC mismatch %X!\n", v);
             return AVERROR_INVALIDDATA;
         }