[FFmpeg-cvslog] lavf/utils: Avoid an overflow for huge negative durations.

Carl Eugen Hoyos git at videolan.org
Sat Sep 24 22:12:16 EEST 2016


ffmpeg | branch: release/3.1 | Carl Eugen Hoyos <cehoyos at ag.or.at> | Sat Sep 24 13:07:39 2016 +0200| [8b21b44e7e312589a6c4dbad1b4214f2a03fb54a] | committer: Carl Eugen Hoyos

lavf/utils: Avoid an overflow for huge negative durations.

Fixes ticket #5135.
(cherry picked from commit 267da70ea8c36caaa645a3c4f1c5f0ca8bae156a)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8b21b44e7e312589a6c4dbad1b4214f2a03fb54a
---

 libavformat/utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index d2a709c..f470c79 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2500,7 +2500,7 @@ static void update_stream_timings(AVFormatContext *ic)
             end_time1 = av_rescale_q_rnd(st->duration, st->time_base,
                                          AV_TIME_BASE_Q,
                                          AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);
-            if (end_time1 != AV_NOPTS_VALUE && start_time1 <= INT64_MAX - end_time1) {
+            if (end_time1 != AV_NOPTS_VALUE && (end_time1 > 0 ? start_time1 <= INT64_MAX - end_time1 : start_time1 >= INT64_MIN - end_time1)) {
                 end_time1 += start_time1;
                 end_time = FFMAX(end_time, end_time1);
             }



More information about the ffmpeg-cvslog mailing list