matroskademux: Only unmap GstMapInfo in WavPack header extraction error paths if...
authorSebastian Dröge <sebastian@centricular.com>
Mon, 30 Sep 2024 13:32:48 +0000 (16:32 +0300)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Tue, 3 Dec 2024 15:28:34 +0000 (15:28 +0000)
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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8058>

subprojects/gst-plugins-good/gst/matroska/matroska-demux.c

index 41725e83a607ac30caf4edd062cdc23d39fea7d9..9e0de058e64a20cfa8b53eabada50c4bfa8eb60c 100644 (file)
@@ -3891,7 +3891,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;
 
@@ -3908,11 +3907,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;
     }
 
@@ -3950,6 +3949,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;