From a593e4966ea9d9f527750a161447bae74510079c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 25 Apr 2017 17:11:27 +0300 Subject: [PATCH] qtdemux: Don't perform seeks with inconsistent seek values If gst_segment_do_seek() fails, we shouldn't try seeking on that resulting segment but just error out. Crashes further down the line otherwise. --- gst/isomp4/qtdemux.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c index 6a5ed276f0..b321b97454 100644 --- a/gst/isomp4/qtdemux.c +++ b/gst/isomp4/qtdemux.c @@ -1628,6 +1628,7 @@ gst_qtdemux_do_seek (GstQTDemux * qtdemux, GstPad * pad, GstEvent * event) GstSegment seeksegment; guint32 seqnum = 0; GstEvent *flush_event; + gboolean ret; if (event) { GST_DEBUG_OBJECT (qtdemux, "doing seek with event"); @@ -1674,13 +1675,19 @@ gst_qtdemux_do_seek (GstQTDemux * qtdemux, GstPad * pad, GstEvent * event) if (event) { /* configure the segment with the seek variables */ GST_DEBUG_OBJECT (qtdemux, "configuring seek"); - gst_segment_do_seek (&seeksegment, rate, format, flags, - cur_type, cur, stop_type, stop, &update); + if (!gst_segment_do_seek (&seeksegment, rate, format, flags, + cur_type, cur, stop_type, stop, &update)) { + ret = FALSE; + GST_ERROR_OBJECT (qtdemux, "inconsistent seek values, doing nothing"); + } else { + /* now do the seek */ + ret = gst_qtdemux_perform_seek (qtdemux, &seeksegment, seqnum, flags); + } + } else { + /* now do the seek */ + ret = gst_qtdemux_perform_seek (qtdemux, &seeksegment, seqnum, flags); } - /* now do the seek, this actually never returns FALSE */ - gst_qtdemux_perform_seek (qtdemux, &seeksegment, seqnum, flags); - /* prepare for streaming again */ if (flush) { flush_event = gst_event_new_flush_stop (TRUE); @@ -1708,7 +1715,7 @@ gst_qtdemux_do_seek (GstQTDemux * qtdemux, GstPad * pad, GstEvent * event) GST_PAD_STREAM_UNLOCK (qtdemux->sinkpad); - return TRUE; + return ret; /* ERRORS */ no_format: