94 lines
3.7 KiB
Diff
94 lines
3.7 KiB
Diff
|
From c78648f7ac1cb153448b15adfa215b984c99782a Mon Sep 17 00:00:00 2001
|
||
|
From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= <sebastian@centricular.com>
|
||
|
Date: Fri, 27 Sep 2024 10:39:30 +0300
|
||
|
Subject: [PATCH 25/28] qtdemux: Actually handle errors returns from various
|
||
|
functions instead of ignoring them
|
||
|
|
||
|
Ignoring them might cause the element to continue as if all is fine despite the
|
||
|
internal state being inconsistent. This can lead to all kinds of follow-up
|
||
|
issues, including memory safety issues.
|
||
|
|
||
|
Thanks to Antonio Morales for finding and reporting the issue.
|
||
|
|
||
|
Fixes GHSL-2024-245
|
||
|
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3847
|
||
|
|
||
|
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8060>
|
||
|
---
|
||
|
.../gst-plugins-good/gst/isomp4/qtdemux.c | 29 +++++++++++++++----
|
||
|
1 file changed, 23 insertions(+), 6 deletions(-)
|
||
|
|
||
|
diff --git a/subprojects/gst-plugins-good/gst/isomp4/qtdemux.c b/subprojects/gst-plugins-good/gst/isomp4/qtdemux.c
|
||
|
index ffd53fbb38..af66740aa9 100644
|
||
|
--- a/subprojects/gst-plugins-good/gst/isomp4/qtdemux.c
|
||
|
+++ b/subprojects/gst-plugins-good/gst/isomp4/qtdemux.c
|
||
|
@@ -4852,10 +4852,15 @@ gst_qtdemux_loop_state_header (GstQTDemux * qtdemux)
|
||
|
beach:
|
||
|
if (ret == GST_FLOW_EOS && (qtdemux->got_moov || qtdemux->media_caps)) {
|
||
|
/* digested all data, show what we have */
|
||
|
- qtdemux_prepare_streams (qtdemux);
|
||
|
+ ret = qtdemux_prepare_streams (qtdemux);
|
||
|
+ if (ret != GST_FLOW_OK)
|
||
|
+ return ret;
|
||
|
+
|
||
|
QTDEMUX_EXPOSE_LOCK (qtdemux);
|
||
|
ret = qtdemux_expose_streams (qtdemux);
|
||
|
QTDEMUX_EXPOSE_UNLOCK (qtdemux);
|
||
|
+ if (ret != GST_FLOW_OK)
|
||
|
+ return ret;
|
||
|
|
||
|
qtdemux->state = QTDEMUX_STATE_MOVIE;
|
||
|
GST_DEBUG_OBJECT (qtdemux, "switching state to STATE_MOVIE (%d)",
|
||
|
@@ -7547,13 +7552,21 @@ gst_qtdemux_process_adapter (GstQTDemux * demux, gboolean force)
|
||
|
gst_qtdemux_stream_concat (demux,
|
||
|
demux->old_streams, demux->active_streams);
|
||
|
|
||
|
- qtdemux_parse_moov (demux, data, demux->neededbytes);
|
||
|
+ if (!qtdemux_parse_moov (demux, data, demux->neededbytes)) {
|
||
|
+ ret = GST_FLOW_ERROR;
|
||
|
+ break;
|
||
|
+ }
|
||
|
qtdemux_node_dump (demux, demux->moov_node);
|
||
|
qtdemux_parse_tree (demux);
|
||
|
- qtdemux_prepare_streams (demux);
|
||
|
+ ret = qtdemux_prepare_streams (demux);
|
||
|
+ if (ret != GST_FLOW_OK)
|
||
|
+ break;
|
||
|
+
|
||
|
QTDEMUX_EXPOSE_LOCK (demux);
|
||
|
- qtdemux_expose_streams (demux);
|
||
|
+ ret = qtdemux_expose_streams (demux);
|
||
|
QTDEMUX_EXPOSE_UNLOCK (demux);
|
||
|
+ if (ret != GST_FLOW_OK)
|
||
|
+ break;
|
||
|
|
||
|
demux->got_moov = TRUE;
|
||
|
|
||
|
@@ -7644,8 +7657,10 @@ gst_qtdemux_process_adapter (GstQTDemux * demux, gboolean force)
|
||
|
/* in MSS we need to expose the pads after the first moof as we won't get a moov */
|
||
|
if (demux->variant == VARIANT_MSS_FRAGMENTED && !demux->exposed) {
|
||
|
QTDEMUX_EXPOSE_LOCK (demux);
|
||
|
- qtdemux_expose_streams (demux);
|
||
|
+ ret = qtdemux_expose_streams (demux);
|
||
|
QTDEMUX_EXPOSE_UNLOCK (demux);
|
||
|
+ if (ret != GST_FLOW_OK)
|
||
|
+ goto done;
|
||
|
}
|
||
|
|
||
|
gst_qtdemux_check_send_pending_segment (demux);
|
||
|
@@ -13758,8 +13773,10 @@ qtdemux_prepare_streams (GstQTDemux * qtdemux)
|
||
|
|
||
|
/* parse the initial sample for use in setting the frame rate cap */
|
||
|
while (sample_num == 0 && sample_num < stream->n_samples) {
|
||
|
- if (!qtdemux_parse_samples (qtdemux, stream, sample_num))
|
||
|
+ if (!qtdemux_parse_samples (qtdemux, stream, sample_num)) {
|
||
|
+ ret = GST_FLOW_ERROR;
|
||
|
break;
|
||
|
+ }
|
||
|
++sample_num;
|
||
|
}
|
||
|
}
|
||
|
--
|
||
|
2.47.0
|
||
|
|