[FFmpeg-cvslog] avformat/aiffdec: Use av_rescale() for bitrate

Michael Niedermayer git at videolan.org
Wed Apr 6 22:55:04 EEST 2022


ffmpeg | branch: release/4.3 | Michael Niedermayer <michael at niedermayer.cc> | Sun Oct 31 00:11:23 2021 +0200| [00530ff352bf09d5ce64d7af153241fc43e94478] | committer: Michael Niedermayer

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 at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 905588df975071c03c00b2e923c311b4de65a8f4)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=00530ff352bf09d5ce64d7af153241fc43e94478
---

 libavformat/aiffdec.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c
index ffe47a7711..85e8138133 100644
--- a/libavformat/aiffdec.c
+++ b/libavformat/aiffdec.c
@@ -187,8 +187,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 */



More information about the ffmpeg-cvslog mailing list