]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/utils: Use more bits for intermediate for AV_CODEC_ID_ADPCM_MS
authorMichael Niedermayer <michael@niedermayer.cc>
Mon, 1 Feb 2021 18:55:03 +0000 (19:55 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Mon, 15 Mar 2021 21:24:31 +0000 (22:24 +0100)
Fixes: signed integer overflow: 1172577312 * 2 cannot be represented in type 'int'
Fixes: 29924/clusterfuzz-testcase-minimized-ffmpeg_dem_BOA_fuzzer-4882912874594304
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/utils.c

index b8a8c0ac2e639c08164a656f19792c0ecfde8a86..66d286565b7b72b51284f6304c5960eadcd26fc1 100644 (file)
@@ -1797,7 +1797,7 @@ static int get_audio_frame_duration(enum AVCodecID id, int sr, int ch, int ba,
                 case AV_CODEC_ID_ADPCM_IMA_RAD:
                     return blocks * ((ba - 4 * ch) * 2 / ch);
                 case AV_CODEC_ID_ADPCM_MS:
-                    return blocks * (2 + (ba - 7 * ch) * 2 / ch);
+                    return blocks * (2 + (ba - 7 * ch) * 2LL / ch);
                 case AV_CODEC_ID_ADPCM_MTAF:
                     return blocks * (ba - 16) * 2 / ch;
                 }