mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-25 00:32:31 +00:00
lavf: Make sure avg_frame_rate can be calculated without integer overflow
If either of the deltas is too large for the multiplications to succeed, don't use this for setting the avg frame rate. Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Cc: libav-stable@libav.org Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
parent
31931520df
commit
e740929a07
@ -2355,6 +2355,9 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
|
||||
int best_fps = 0;
|
||||
double best_error = 0.01;
|
||||
|
||||
if (delta_dts >= INT64_MAX / st->time_base.num ||
|
||||
delta_packets >= INT64_MAX / st->time_base.den)
|
||||
continue;
|
||||
av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den,
|
||||
delta_packets*(int64_t)st->time_base.den,
|
||||
delta_dts*(int64_t)st->time_base.num, 60000);
|
||||
|
Loading…
Reference in New Issue
Block a user