]> git.sesse.net Git - ffmpeg/commitdiff
avformat/movenc: Check that pkt duration is within 32bit range
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 9 Jan 2016 02:36:19 +0000 (03:36 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 9 Jan 2016 02:38:03 +0000 (03:38 +0100)
Durations outside are not supported

Fixes Ticket5114
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/movenc.c

index 5594c6d91319d66fb9eff1c0e401ddab9266c772..1aff5c52f4b3a3f15765eb6bf1cb22a3a4261c4e 100644 (file)
@@ -4362,10 +4362,10 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
             pkt->dts = trk->cluster[trk->entry - 1].dts + 1;
             pkt->pts = AV_NOPTS_VALUE;
         }
-        if (pkt->duration < 0) {
-            av_log(s, AV_LOG_ERROR, "Application provided duration: %"PRId64" is invalid\n", pkt->duration);
-            return AVERROR(EINVAL);
-        }
+    }
+    if (pkt->duration < 0 || pkt->duration > INT_MAX) {
+        av_log(s, AV_LOG_ERROR, "Application provided duration: %"PRId64" is invalid\n", pkt->duration);
+        return AVERROR(EINVAL);
     }
     if (mov->flags & FF_MOV_FLAG_FRAGMENT) {
         int ret;