[FFmpeg-cvslog] ffmpeg: Fix integer overflow with cur_dts being AV_NOPTS_VALUE

Michael Niedermayer git at videolan.org
Wed Nov 11 17:59:58 CET 2015


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Wed Nov 11 17:19:12 2015 +0100| [6770a9d6898a0c7561586dabd7a4e5b5187bed62] | committer: Michael Niedermayer

ffmpeg: Fix integer overflow with cur_dts being AV_NOPTS_VALUE

Since de0e219a8aba72de201e85385c746cd1c04be1a2 cur_dts is sometimes invalid

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

 ffmpeg.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 438175b..3341777 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -3382,8 +3382,12 @@ static OutputStream *choose_output(void)
 
     for (i = 0; i < nb_output_streams; i++) {
         OutputStream *ost = output_streams[i];
-        int64_t opts = av_rescale_q(ost->st->cur_dts, ost->st->time_base,
+        int64_t opts = ost->st->cur_dts == AV_NOPTS_VALUE ? INT64_MIN :
+                       av_rescale_q(ost->st->cur_dts, ost->st->time_base,
                                     AV_TIME_BASE_Q);
+        if (ost->st->cur_dts == AV_NOPTS_VALUE)
+            av_log(NULL, AV_LOG_DEBUG, "cur_dts is invalid (this is harmless if it occurs once at the start per stream)\n");
+
         if (!ost->finished && opts < opts_min) {
             opts_min = opts;
             ost_min  = ost->unavailable ? NULL : ost;



More information about the ffmpeg-cvslog mailing list