[FFmpeg-cvslog] avformat/utils: Move end_time1 AV_NOPTS_VALUE Check after rescale

Michael Niedermayer git at videolan.org
Thu Dec 3 00:21:47 CET 2015


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Wed Dec  2 22:59:56 2015 +0100| [ec7a3be11ed33002c8609e5d30e908a7c8827a43] | committer: Michael Niedermayer

avformat/utils: Move end_time1 AV_NOPTS_VALUE Check after rescale

Fixes integer overflow
Fixes: 266ee543812e934f7b4a72923a2701d4/signal_sigabrt_7ffff6ae7cc9_7322_85218d61759d461bdf7387180e8000c9.ogg

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavformat/utils.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 4475df9..973256f 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2342,11 +2342,11 @@ static void update_stream_timings(AVFormatContext *ic)
                     start_time_text = start_time1;
             } else
                 start_time = FFMIN(start_time, start_time1);
-            end_time1   = AV_NOPTS_VALUE;
-            if (st->duration != AV_NOPTS_VALUE) {
-                end_time1 = start_time1 +
-                            av_rescale_q(st->duration, st->time_base,
-                                         AV_TIME_BASE_Q);
+            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) {
+                end_time1 += start_time1;
                 end_time = FFMAX(end_time, end_time1);
             }
             for (p = NULL; (p = av_find_program_from_stream(ic, p, i)); ) {



More information about the ffmpeg-cvslog mailing list