aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-10-31 00:11:23 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2022-04-07 16:26:59 +0200
commitd2d817eaf2d32e0f2fd1479e949289bf4125d562 (patch)
tree1a80b2c256b6a300556f1c4f141db96bac899256 /libavformat
parented968f5290bb0fb2f679bfed0b7da6613b1d090e (diff)
downloadffmpeg-d2d817eaf2d32e0f2fd1479e949289bf4125d562.tar.gz
avformat/aiffdec: Use av_rescale() for bitrate
Fixes: integer overflow Fixes: 40313/clusterfuzz-testcase-minimized-ffmpeg_dem_AIFF_fuzzer-4814761406103552 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> (cherry picked from commit 905588df975071c03c00b2e923c311b4de65a8f4) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/aiffdec.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c
index 12469f5105..68961c447a 100644
--- a/libavformat/aiffdec.c
+++ b/libavformat/aiffdec.c
@@ -186,8 +186,10 @@ static int get_aiff_header(AVFormatContext *s, int size,
par->block_align = (av_get_bits_per_sample(par->codec_id) * par->channels) >> 3;
if (aiff->block_duration) {
- par->bit_rate = (int64_t)par->sample_rate * (par->block_align << 3) /
- aiff->block_duration;
+ par->bit_rate = av_rescale(par->sample_rate, par->block_align * 8LL,
+ aiff->block_duration);
+ if (par->bit_rate < 0)
+ par->bit_rate = 0;
}
/* Chunk is over */