avformat/movenc: Check that packet duration is valid in ff_mov_write_packet()
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 23 May 2014 01:59:32 +0000 (03:59 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 23 May 2014 02:00:29 +0000 (04:00 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/movenc.c

index 12111cb..25c462d 100644 (file)
@@ -3333,6 +3333,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: %d is invalid\n", pkt->duration);
+            return AVERROR(EINVAL);
+        }
     }
     if (mov->flags & FF_MOV_FLAG_FRAGMENT) {
         int ret;