]> git.sesse.net Git - ffmpeg/commitdiff
avformat/movenc: Check first DTS similar to dts difference
authorMichael Niedermayer <michael@niedermayer.cc>
Fri, 9 Sep 2016 11:11:43 +0000 (13:11 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Fri, 9 Sep 2016 22:50:36 +0000 (00:50 +0200)
Fixes assertion failure
Fixes: b84b53855a0b74560e64c6f45f505a13/signal_sigabrt_7ffff6ae7c37_3837_ef4e243ea5b4fa8d0becf4afe9166604.avi
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/movenc.c

index b82bfea2b6ec83a87e5a09c385679ecf8c29603a..319ff5701a052e98a5b787eaf5e01c3120c5a8fd 100644 (file)
@@ -4682,6 +4682,13 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
             pkt->dts = trk->cluster[trk->entry - 1].dts + 1;
             pkt->pts = AV_NOPTS_VALUE;
         }
+    } else if (pkt->dts <= INT_MIN || pkt->dts >= INT_MAX) {
+            av_log(s, AV_LOG_ERROR, "Application provided initial timestamp: %"PRId64" is out of range for mov/mp4 format\n",
+                pkt->dts
+            );
+
+            pkt->dts = 0;
+            pkt->pts = AV_NOPTS_VALUE;
     }
     if (pkt->duration < 0 || pkt->duration > INT_MAX) {
         av_log(s, AV_LOG_ERROR, "Application provided duration: %"PRId64" is invalid\n", pkt->duration);