OSDN Git Service

avcodec/snowdec: Check qbias
authorMichael Niedermayer <michael@niedermayer.cc>
Fri, 5 May 2017 23:08:54 +0000 (01:08 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 6 May 2017 00:11:34 +0000 (02:11 +0200)
Fixes: signed integer overflow: -1094995529 * 131 cannot be represented in type 'int'
Fixes: 1353/clusterfuzz-testcase-minimized-5208180449607680

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/snowdec.c

index 042aecb..97f5528 100644 (file)
@@ -395,6 +395,11 @@ static int decode_header(SnowContext *s){
         s->block_max_depth= 0;
         return AVERROR_INVALIDDATA;
     }
+    if (FFABS(s->qbias) > 127) {
+        av_log(s->avctx, AV_LOG_ERROR, "qbias %d is too large\n", s->qbias);
+        s->qbias = 0;
+        return AVERROR_INVALIDDATA;
+    }
 
     return 0;
 }