aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-06-21 12:24:04 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2020-07-02 19:55:10 +0200
commit2a4edfd64c07d925770977693717ebd83183dd27 (patch)
tree62fde1a372363502a4416a46d4b73b40ce518539
parent6674fb44f109ce022f5afa7092e156a95502194d (diff)
downloadffmpeg-2a4edfd64c07d925770977693717ebd83183dd27.tar.gz
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@niedermayer.cc> (cherry picked from commit 10cc82c35baabbb07ffec3faccb04d8928c39e4c) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/utils.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index c561c2089b..b72f23e422 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2707,7 +2707,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;