This avoids setting avg_frame_rate to invalid (negative)
values.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: [email protected]
---
 libavformat/utils.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 22f6d01..0700c5d 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2373,7 +2373,8 @@ int avformat_find_stream_info(AVFormatContext *ic, 
AVDictionary **options)
                 double best_error = 0.01;
 
                 if (delta_dts     >= INT64_MAX / st->time_base.num ||
-                    delta_packets >= INT64_MAX / st->time_base.den)
+                    delta_packets >= INT64_MAX / st->time_base.den ||
+                    delta_dts < 0)
                     continue;
                 av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den,
                           delta_packets*(int64_t)st->time_base.den,
-- 
1.7.9.5

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to