mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-03-04 11:38:19 +00:00
lavf: avoid integer overflow when estimating bitrate
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit df33a58e53
)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
This commit is contained in:
parent
5773065a71
commit
8d2a86a290
@ -1953,8 +1953,13 @@ static void estimate_timings_from_bit_rate(AVFormatContext *ic)
|
||||
bit_rate = 0;
|
||||
for(i=0;i<ic->nb_streams;i++) {
|
||||
st = ic->streams[i];
|
||||
if (st->codec->bit_rate > 0)
|
||||
bit_rate += st->codec->bit_rate;
|
||||
if (st->codec->bit_rate > 0) {
|
||||
if (INT_MAX - st->codec->bit_rate > bit_rate) {
|
||||
bit_rate = 0;
|
||||
break;
|
||||
}
|
||||
bit_rate += st->codec->bit_rate;
|
||||
}
|
||||
}
|
||||
ic->bit_rate = bit_rate;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user