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 13:00:06 +0000
commitd62cecf193d6bf3b16fe91d725f4514161f602c3 (patch)
treee9e406b0604b7c78c7ea815c5f854a28923a2aef
parent2bec35e0804e83e874d2db5ea7f7d440687a5275 (diff)
downloadgstreamer-plugins-good-d62cecf193d6bf3b16fe91d725f4514161f602c3.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/904>
-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 b2cd9b5d4..4eb3d2a9f 100644
--- a/gst/matroska/matroska-demux.c
+++ b/gst/matroska/matroska-demux.c
@@ -660,6 +660,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);