avcodec/ffv1dec: check global header version
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 30 Aug 2013 01:43:49 +0000 (03:43 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 31 Aug 2013 02:31:04 +0000 (04:31 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 20b965a1a43ae88b7ae95635d5a3570e7dc2bbd4)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/ffv1dec.c

index a1da544..69930d8 100644 (file)
@@ -447,6 +447,10 @@ static int read_extra_header(FFV1Context *f)
     ff_build_rac_states(c, 0.05 * (1LL << 32), 256 - 8);
 
     f->version = get_symbol(c, state, 0);
+    if (f->version < 2) {
+        av_log(f->avctx, AV_LOG_ERROR, "Invalid version in global header\n");
+        return AVERROR_INVALIDDATA;
+    }
     if (f->version > 2) {
         c->bytestream_end -= 4;
         f->minor_version = get_symbol(c, state, 0);