matroskademux: Initialize track context out parameter to NULL before parsing
authorSebastian Dröge <sebastian@centricular.com>
Wed, 3 Mar 2021 09:31:52 +0000 (11:31 +0200)
committerTim-Philipp Müller <tim@centricular.com>
Mon, 15 Mar 2021 12:34:04 +0000 (12:34 +0000)
commit6c461e90bc1eedce4b7e414d34c8a8a9162359b5
tree4245ec43a50a975a20cd4ba5e06437ed42924c2f
parent76d624b2df5594a82269b94dffe8766a372d059d
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/902>
gst/matroska/matroska-demux.c