[FFmpeg-cvslog] avformat/xwma: Use av_rescale() for duration computation

Michael Niedermayer git at videolan.org
Fri Oct 21 23:51:57 EEST 2022


ffmpeg | branch: release/3.2 | Michael Niedermayer <michael at niedermayer.cc> | Sun Sep 18 16:45:30 2022 +0200| [a9fcab5cdc34c86147e5d4e6eaca28a63bf6b826] | committer: Michael Niedermayer

avformat/xwma: Use av_rescale() for duration computation

Fixes: signed integer overflow: 34242363648 * 538976288 cannot be represented in type 'long'
Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6577923913547776

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 2c789f753c3657be9041307f9c03749f5ba5a6bb)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavformat/xwma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/xwma.c b/libavformat/xwma.c
index 6e74a338bf..babe9bcd30 100644
--- a/libavformat/xwma.c
+++ b/libavformat/xwma.c
@@ -253,7 +253,7 @@ static int xwma_read_header(AVFormatContext *s)
          * the total duration using the average bits per sample and the
          * total data length.
          */
-        st->duration = (size<<3) * st->codecpar->sample_rate / st->codecpar->bit_rate;
+        st->duration = av_rescale((size<<3), st->codecpar->sample_rate, st->codecpar->bit_rate);
     }
 
 fail:



More information about the ffmpeg-cvslog mailing list