[FFmpeg-cvslog] avformat/utils: avoid overflow in update_stream_timings() with huge durations

Michael Niedermayer git at videolan.org
Sun Jun 5 03:16:44 CEST 2016


ffmpeg | branch: release/3.0 | Michael Niedermayer <michael at niedermayer.cc> | Sat May 28 23:51:35 2016 +0200| [cc1e01d8b67f41659cb03f2500f18fe5df647ff1] | committer: Michael Niedermayer

avformat/utils: avoid overflow in update_stream_timings() with huge durations

Fixes: usan_granule_overflow

Found-by: Thomas Guilbert <tguilbert at google.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 2be3007ed55f1513bcae3d2a076e71878f48eb03)

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

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

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 7ed21b6..fe684c3 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2370,7 +2370,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) {
+            if (end_time1 != AV_NOPTS_VALUE && start_time1 <= INT64_MAX - end_time1) {
                 end_time1 += start_time1;
                 end_time = FFMAX(end_time, end_time1);
             }



More information about the ffmpeg-cvslog mailing list