[FFmpeg-cvslog] avformat/utils: reorder duration computation to avoid overflow
Michael Niedermayer
git at videolan.org
Thu Jul 2 11:33:25 EEST 2020
ffmpeg | branch: release/4.3 | Michael Niedermayer <michael at niedermayer.cc> | Sun Jun 21 12:24:04 2020 +0200| [3571d9d654f78c3c16ec17c8260d28f211e9571b] | committer: Michael Niedermayer
avformat/utils: reorder duration computation to avoid overflow
Fixes: signed integer overflow: 8 * 9223372036854774783 cannot be represented in type 'long'
Fixes: 23381/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-4818340509122560
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 10cc82c35baabbb07ffec3faccb04d8928c39e4c)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3571d9d654f78c3c16ec17c8260d28f211e9571b
---
libavformat/utils.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 667249362c..ba8aaebfb7 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2782,7 +2782,7 @@ static void estimate_timings_from_bit_rate(AVFormatContext *ic)
st = ic->streams[i];
if ( st->time_base.num <= INT64_MAX / ic->bit_rate
&& st->duration == AV_NOPTS_VALUE) {
- duration = av_rescale(8 * filesize, st->time_base.den,
+ duration = av_rescale(filesize, 8LL * st->time_base.den,
ic->bit_rate *
(int64_t) st->time_base.num);
st->duration = duration;
More information about the ffmpeg-cvslog
mailing list