mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-02-25 08:10:41 +00:00
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 10cc82c35b
)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
c095e870d8
commit
7b3b3119d5
@ -2775,7 +2775,7 @@ static void estimate_timings_from_bit_rate(AVFormatContext *ic)
|
|||||||
st = ic->streams[i];
|
st = ic->streams[i];
|
||||||
if ( st->time_base.num <= INT64_MAX / ic->bit_rate
|
if ( st->time_base.num <= INT64_MAX / ic->bit_rate
|
||||||
&& st->duration == AV_NOPTS_VALUE) {
|
&& 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 *
|
ic->bit_rate *
|
||||||
(int64_t) st->time_base.num);
|
(int64_t) st->time_base.num);
|
||||||
st->duration = duration;
|
st->duration = duration;
|
||||||
|
Loading…
Reference in New Issue
Block a user