summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2021-03-03 11:31:52 +0200
committerTim-Philipp Müller <tim@centricular.com>2021-03-15 12:56:25 +0000
commit02174790726dd20a5c73ce2002189bf240ad4fe0 (patch)
tree729989c5698270ebb7c17d2f74761e83f2682964
parentda7e8d2146181880aceadf05a07199feea395182 (diff)
downloadgstreamer-plugins-good-02174790726dd20a5c73ce2002189bf240ad4fe0.tar.gz
matroskademux: Initialize track context out parameter to NULL before parsing
Various error return paths don't set it to NULL and callers are only checking if the pointer is NULL. As it's allocated on the stack this usually contains random stack memory, and more often than not the memory of a previously parsed track. This then causes all kinds of memory corruptions further down the line. Thanks to Natalie Silvanovich for reporting. Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/858 Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/903>
-rw-r--r--gst/matroska/matroska-demux.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/gst/matroska/matroska-demux.c b/gst/matroska/matroska-demux.c
index 4d0234743..467815986 100644
--- a/gst/matroska/matroska-demux.c
+++ b/gst/matroska/matroska-demux.c
@@ -692,6 +692,8 @@ gst_matroska_demux_parse_stream (GstMatroskaDemux * demux, GstEbmlRead * ebml,
DEBUG_ELEMENT_START (demux, ebml, "TrackEntry");
+ *dest_context = NULL;
+
/* start with the master */
if ((ret = gst_ebml_read_master (ebml, &id)) != GST_FLOW_OK) {
DEBUG_ELEMENT_STOP (demux, ebml, "TrackEntry", ret);