]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/adpcm: Check initial predictor for ADPCM_IMA_EA_EACS
authorMichael Niedermayer <michael@niedermayer.cc>
Fri, 27 Sep 2019 16:02:17 +0000 (18:02 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Wed, 16 Oct 2019 17:17:57 +0000 (19:17 +0200)
Fixes: signed integer overflow: -2147483360 - 631 cannot be represented in type 'int'
Fixes: 17701/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_IMA_EA_EACS_fuzzer-5711517319692288
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/adpcm.c

index 8ed2b6c9d97aad6c8579d56ca98be0f37197abb2..a8e74522b3b4125450fe2120f38dd366d9fdc233 100644 (file)
@@ -1231,8 +1231,11 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
                 return AVERROR_INVALIDDATA;
             }
         }
-        for (i=0; i<=st; i++)
+        for (i=0; i<=st; i++) {
             c->status[i].predictor  = bytestream2_get_le32u(&gb);
+            if (FFABS(c->status[i].predictor) > (1<<16))
+                return AVERROR_INVALIDDATA;
+        }
 
         for (n = nb_samples >> (1 - st); n > 0; n--) {
             int byte   = bytestream2_get_byteu(&gb);