diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2020-06-21 13:24:04 +0300 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2020-07-01 14:33:45 +0300 |
commit | 89241451959dc4b2c3d5c5ec6fc6c2b522449e34 (patch) | |
tree | fa24e5aade30dbb4123c8f3a81ec68af25205ad1 /libavformat | |
parent | 98980ce38f1d658f46b6b5b4c28084216ce74846 (diff) |
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>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/utils.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index ee03183227..e3bff73bef 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2770,7 +2770,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; |