mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
estimate_timings_from_bit_rate: Check timebase and bitrate
Fixes integer overflow and assertion failure Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
1831274ff1
commit
ea9a6709a9
@ -2325,9 +2325,11 @@ static void estimate_timings_from_bit_rate(AVFormatContext *ic)
|
||||
if (filesize > 0) {
|
||||
for(i = 0; i < ic->nb_streams; i++) {
|
||||
st = ic->streams[i];
|
||||
duration= av_rescale(8*filesize, st->time_base.den, ic->bit_rate*(int64_t)st->time_base.num);
|
||||
if (st->duration == AV_NOPTS_VALUE)
|
||||
if ( st->time_base.num <= INT64_MAX / ic->bit_rate
|
||||
&& st->duration == AV_NOPTS_VALUE) {
|
||||
duration= av_rescale(8*filesize, st->time_base.den, ic->bit_rate*(int64_t)st->time_base.num);
|
||||
st->duration = duration;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user