asfenc: return error on negative timestamp
authorLuca Barbato <lu_zero@gentoo.org>
Sun, 17 Mar 2013 14:13:43 +0000 (15:13 +0100)
committerLuca Barbato <lu_zero@gentoo.org>
Mon, 18 Mar 2013 09:48:23 +0000 (10:48 +0100)
According to the specification the timestamp is represented by a 32bit
unsigned.

CC: libav-stable@libav.org
libavformat/asfenc.c

index a523b3a..6112d3f 100644 (file)
@@ -774,6 +774,14 @@ static int asf_write_packet(AVFormatContext *s, AVPacket *pkt)
         flags &= ~AV_PKT_FLAG_KEY;
 
     pts = (pkt->pts != AV_NOPTS_VALUE) ? pkt->pts : pkt->dts;
+
+    if (pts < 0) {
+        av_log(s, AV_LOG_ERROR,
+               "Negative dts not supported stream %d, dts %"PRId64"\n",
+               pkt->stream_index, pts);
+        return AVERROR(ENOSYS);
+    }
+
     assert(pts != AV_NOPTS_VALUE);
     duration      = pts * 10000;
     asf->duration = FFMAX(asf->duration, duration + pkt->duration * 10000);