File CVE-2024-47613.patch of Package gstreamer-plugins-good.36926

From 1d1c9d63be51d85f9b80f0c227d4b3469fee2534 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= <sebastian@centricular.com>
Date: Wed, 2 Oct 2024 14:44:21 +0300
Subject: [PATCH] gdkpixbufdec: Check if initializing the video info actually
 succeeded

Otherwise a 0-byte buffer would be allocated, which gives NULL memory when
mapped.

Thanks to Antonio Morales for finding and reporting the issue.

Fixes GHSL-2024-118
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3876

Backported by Mike Gorse <mgorse@suse.com>
---
diff -urp gst-plugins-good-1.8.3.orig/ext/gdk_pixbuf/gstgdkpixbufdec.c gst-plugins-good-1.8.3/ext/gdk_pixbuf/gstgdkpixbufdec.c
--- gst-plugins-good-1.8.3.orig/ext/gdk_pixbuf/gstgdkpixbufdec.c	2025-01-04 12:53:36.208151428 -0600
+++ gst-plugins-good-1.8.3/ext/gdk_pixbuf/gstgdkpixbufdec.c	2025-01-04 13:08:38.109395476 -0600
@@ -319,6 +319,9 @@ gst_gdk_pixbuf_dec_flush (GstGdkPixbufDe
 
     gst_video_info_init (&info);
     gst_video_info_set_format (&info, fmt, width, height);
+    /* If fill_plains succeeded, then size will be > 0 */
+    if (width && !info.size)
+      goto format_not_supported;
     info.fps_n = filter->in_fps_n;
     info.fps_d = filter->in_fps_d;
     caps = gst_video_info_to_caps (&info);
@@ -379,6 +382,12 @@ channels_not_supported:
         ("%d channels not supported", n_channels));
     return GST_FLOW_ERROR;
   }
+format_not_supported:
+  {
+    GST_ELEMENT_ERROR (filter, STREAM, DECODE, (NULL),
+        ("%d channels with %dx%d not supported", n_channels, width, height));
+    return GST_FLOW_ERROR;
+  }
 no_buffer:
   {
     GST_DEBUG ("Failed to create outbuffer - %s", gst_flow_get_name (ret));
openSUSE Build Service is sponsored by