avcodec/utils: fix 2 integer overflows in get_audio_frame_duration()

Fixes: signed integer overflow: 256 * 668003712 cannot be represented in type 'int'
Fixes: 59819/clusterfuzz-testcase-minimized-ffmpeg_dem_MATROSKA_fuzzer-4674636538052608

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit a4bf559683)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2023-06-18 21:00:03 +02:00
parent 99c01fa0df
commit 5524362efb
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64
1 changed files with 2 additions and 2 deletions

View File

@ -1635,9 +1635,9 @@ static int get_audio_frame_duration(enum AVCodecID id, int sr, int ch, int ba,
if (sr > 0) {
/* calc from sample rate */
if (id == AV_CODEC_ID_TTA)
return 256 * sr / 245;
return 256ll * sr / 245;
else if (id == AV_CODEC_ID_DST)
return 588 * sr / 44100;
return 588ll * sr / 44100;
if (ch > 0) {
/* calc from sample rate and channels */