]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/vmdaudio: Check block_align more
authorMichael Niedermayer <michael@niedermayer.cc>
Mon, 6 Jan 2020 00:38:21 +0000 (01:38 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Tue, 7 Jan 2020 01:49:54 +0000 (02:49 +0100)
Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'
Fixes: 19788/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VMDAUDIO_fuzzer-5743379690553344
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/vmdaudio.c

index c7826fa3ce456dc4d38a026110d2b845a2ba35db..dfbd49fd8408714fa61ec494a30ba59951ac4203 100644 (file)
@@ -76,7 +76,9 @@ static av_cold int vmdaudio_decode_init(AVCodecContext *avctx)
         av_log(avctx, AV_LOG_ERROR, "invalid number of channels\n");
         return AVERROR(EINVAL);
     }
-    if (avctx->block_align < 1 || avctx->block_align % avctx->channels) {
+    if (avctx->block_align < 1 || avctx->block_align % avctx->channels ||
+        avctx->block_align > INT_MAX - avctx->channels
+    ) {
         av_log(avctx, AV_LOG_ERROR, "invalid block align\n");
         return AVERROR(EINVAL);
     }