summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.com>2017-09-23 15:38:07 -0400
committerSebastian Dröge <sebastian@centricular.com>2017-10-19 15:58:12 +0200
commit83994c427410473815ff894a4b519cc36c24327f (patch)
treea9fbb88b09ad92a60c998be891e3fe5adf018f2f
parent86a56cc48c521d4fbd4c73c903a58787313458d4 (diff)
downloadgstreamer-plugins-good-83994c427410473815ff894a4b519cc36c24327f.tar.gz
flvdemux: Avoid integer overflow on invalid CTS
If the CTS is negative an would lead to a negtive PTS, clip the CTS so the PTS will be 0. https://bugzilla.gnome.org/show_bug.cgi?id=787795
-rw-r--r--gst/flv/gstflvdemux.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gst/flv/gstflvdemux.c b/gst/flv/gstflvdemux.c
index 61f29d56b..4c200e220 100644
--- a/gst/flv/gstflvdemux.c
+++ b/gst/flv/gstflvdemux.c
@@ -1502,6 +1502,12 @@ gst_flv_demux_parse_tag_video (GstFlvDemux * demux, GstBuffer * buffer)
cts = GST_READ_UINT24_BE (data + 9);
cts = (cts + 0xff800000) ^ 0xff800000;
+ if (cts < 0 && ABS (cts) > dts) {
+ GST_ERROR_OBJECT (demux, "Detected a negative composition time offset "
+ "'%d' that would lead to negative PTS, fixing", cts);
+ cts += ABS (cts) - dts;
+ }
+
GST_LOG_OBJECT (demux, "got cts %d", cts);
}