From c7f995f1030efb3281faa72a1a8827969f3591bc Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 16 Dec 2024 11:48:03 +0100 Subject: [PATCH 6/9] matroskademux: Only unmap GstMapInfo in WavPack header extraction error paths if previously mapped Thanks to Antonio Morales for finding and reporting the issue. Fixes GHSL-2024-197 Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3863 Part-of: --- gst/matroska/matroska-demux.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gst/matroska/matroska-demux.c b/gst/matroska/matroska-demux.c index f890ae611..2db68bc1f 100644 --- a/gst/matroska/matroska-demux.c +++ b/gst/matroska/matroska-demux.c @@ -3687,7 +3687,6 @@ gst_matroska_demux_add_wvpk_header (GstElement * element, GstMatroskaTrackAudioContext *audiocontext = (GstMatroskaTrackAudioContext *) stream; GstBuffer *newbuf = NULL; - GstMapInfo map, outmap; guint8 *buf_data, *data; Wavpack4Header wvh; @@ -3704,11 +3703,11 @@ gst_matroska_demux_add_wvpk_header (GstElement * element, if (audiocontext->channels <= 2) { guint32 block_samples, tmp; + GstMapInfo outmap; gsize size = gst_buffer_get_size (*buf); if (size < 4) { GST_ERROR_OBJECT (element, "Too small wavpack buffer"); - gst_buffer_unmap (*buf, &map); return GST_FLOW_ERROR; } @@ -3746,6 +3745,7 @@ gst_matroska_demux_add_wvpk_header (GstElement * element, *buf = newbuf; audiocontext->wvpk_block_index += block_samples; } else { + GstMapInfo map, outmap; guint8 *outdata = NULL; gsize buf_size, size; guint32 block_samples, flags, crc, blocksize; -- 2.47.0