]> git.sesse.net Git - ffmpeg/commitdiff
avformat/wavdec: Check block_align vs. channels before combining them
authorMichael Niedermayer <michael@niedermayer.cc>
Sun, 17 Jan 2021 22:16:46 +0000 (23:16 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Tue, 2 Feb 2021 12:12:12 +0000 (13:12 +0100)
Fixes: signed integer overflow: 65535 * 65312 cannot be represented in type 'int'
Fixes: 26910/clusterfuzz-testcase-minimized-ffmpeg_dem_WAV_fuzzer-6606935226974208
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/wavdec.c

index 2fba9a08c84c65824959ddef13cc23dfbd6d3481..256c36ebe2a2c22c317c68df0cec13834e8e38d9 100644 (file)
@@ -643,7 +643,8 @@ break_loop:
     } else if (st->codecpar->codec_id == AV_CODEC_ID_XMA1 ||
                st->codecpar->codec_id == AV_CODEC_ID_XMA2) {
         st->codecpar->block_align = 2048;
-    } else if (st->codecpar->codec_id == AV_CODEC_ID_ADPCM_MS && st->codecpar->channels > 2) {
+    } else if (st->codecpar->codec_id == AV_CODEC_ID_ADPCM_MS && st->codecpar->channels > 2 &&
+               st->codecpar->block_align < INT_MAX / st->codecpar->channels) {
         st->codecpar->block_align *= st->codecpar->channels;
     }