qtdemux: Fix crash on MSE-style flush

The flowcombiner and active_streams shouldn't be cleared in the
mse-bytestream variant, only in the mss-fragmented one. Otherwise the
soft reset leaves qtdemux in a state where it still believes that it has
streams, but they've been cleared. In that case, a null pointer
dereference happens and the app crashes.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4199>
This commit is contained in:
Enrique Ocaña González 2023-03-16 20:54:14 +01:00 committed by GStreamer Marge Bot
parent d3f92b9760
commit 735dac9d2f

View file

@ -2082,11 +2082,12 @@ gst_qtdemux_reset (GstQTDemux * qtdemux, gboolean hard)
g_free (qtdemux->preferred_protection_system_id); g_free (qtdemux->preferred_protection_system_id);
qtdemux->preferred_protection_system_id = NULL; qtdemux->preferred_protection_system_id = NULL;
} }
} else if (qtdemux->variant == VARIANT_MSS_FRAGMENTED } else if (qtdemux->variant == VARIANT_MSS_FRAGMENTED) {
|| qtdemux->variant == VARIANT_MSE_BYTESTREAM) {
gst_flow_combiner_reset (qtdemux->flowcombiner); gst_flow_combiner_reset (qtdemux->flowcombiner);
g_ptr_array_foreach (qtdemux->active_streams, g_ptr_array_foreach (qtdemux->active_streams,
(GFunc) gst_qtdemux_stream_clear, NULL); (GFunc) gst_qtdemux_stream_clear, NULL);
} else if (qtdemux->variant == VARIANT_MSE_BYTESTREAM) {
/* Do nothing */
} else { } else {
gst_flow_combiner_reset (qtdemux->flowcombiner); gst_flow_combiner_reset (qtdemux->flowcombiner);
for (i = 0; i < QTDEMUX_N_STREAMS (qtdemux); i++) { for (i = 0; i < QTDEMUX_N_STREAMS (qtdemux); i++) {