From: Sebastian Dröge Date: Mon, 30 Sep 2024 16:04:51 +0000 (+0300) Subject: matroskademux: Don't take data out of an empty adapter when processing WavPack frames X-Git-Tag: 1.24.10~19 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2dcb071d4995032ed9242bb863189939b211f5cc;p=platform%2Fupstream%2Fgstreamer.git matroskademux: Don't take data out of an empty adapter when processing WavPack frames Thanks to Antonio Morales for finding and reporting the issue. Fixes GHSL-2024-249 Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3865 Part-of: --- diff --git a/subprojects/gst-plugins-good/gst/matroska/matroska-demux.c b/subprojects/gst-plugins-good/gst/matroska/matroska-demux.c index 2a3df8b6c5..4e546b439c 100644 --- a/subprojects/gst-plugins-good/gst/matroska/matroska-demux.c +++ b/subprojects/gst-plugins-good/gst/matroska/matroska-demux.c @@ -4042,11 +4042,16 @@ gst_matroska_demux_add_wvpk_header (GstElement * element, } gst_buffer_unmap (*buf, &map); - newbuf = gst_adapter_take_buffer (adapter, gst_adapter_available (adapter)); + size = gst_adapter_available (adapter); + if (size > 0) { + newbuf = gst_adapter_take_buffer (adapter, size); + gst_buffer_copy_into (newbuf, *buf, + GST_BUFFER_COPY_TIMESTAMPS | GST_BUFFER_COPY_FLAGS, 0, -1); + } else { + newbuf = NULL; + } g_object_unref (adapter); - gst_buffer_copy_into (newbuf, *buf, - GST_BUFFER_COPY_TIMESTAMPS | GST_BUFFER_COPY_FLAGS, 0, -1); gst_buffer_unref (*buf); *buf = newbuf;