From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= <sebastian@centricular.com>
Date: Fri, 4 Oct 2024 13:22:02 +0300
Subject: wavparse: Check that at least 32 bytes are available before parsing
 smpl chunks
Origin: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/commit/3d2a5841d777dd95afdea30ad134f96c876f84ab
Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2024-47777

Thanks to Antonio Morales for finding and reporting the issue.

Fixes GHSL-2024-259
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3887

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8054>
---
 subprojects/gst-plugins-good/gst/wavparse/gstwavparse.c | 3 +++
 1 file changed, 3 insertions(+)

--- a/gst/wavparse/gstwavparse.c
+++ b/gst/wavparse/gstwavparse.c
@@ -893,6 +893,9 @@ gst_wavparse_smpl_chunk (GstWavParse * w
 {
   guint32 note_number;
 
+  if (size < 32)
+    return FALSE;
+
   /*
      manufacturer_id = GST_READ_UINT32_LE (data);
      product_id = GST_READ_UINT32_LE (data + 4);
