flvdemux: be careful with negative cts
authorStas Sergeev <stsp@users.sourceforge.net>
Tue, 11 Oct 2011 16:56:51 +0000 (20:56 +0400)
committerMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
Fri, 28 Oct 2011 10:31:15 +0000 (12:31 +0200)
Fixes #661477.

gst/flv/gstflvdemux.c

index 7432520..8aa352e 100644 (file)
@@ -1195,7 +1195,9 @@ gst_flv_demux_parse_tag_video (GstFlvDemux * demux, GstBuffer * buffer)
 
     GST_LOG_OBJECT (demux, "got cts %d", cts);
 
-    pts = pts + cts;
+    /* avoid negative overflow */
+    if (cts >= 0 || pts >= -cts)
+      pts += cts;
   }
 
   GST_LOG_OBJECT (demux, "video tag with codec tag %u, keyframe (%d) "