File gstreamer-CVE-2023-40474.patch of Package gstreamer.31978
commit a0fd447abeb52b3ce485209452b6ebfadb6126fb (HEAD -> Add_gst_clear_caps_a0fd447abeb52b3ce485209452b6ebfadb6126fb)
Author: Niels De Graef <nielsdegraef@gmail.com>
Date: Sun Nov 4 18:53:31 2018 +0100
caps: add gst_clear_caps()
Basically, you can use this instead of using gst_caps_unref (which
needs to be preceded by a NULL-check).
Also fixes #275
diff -Nura gstreamer-1.12.5/gst/gstcaps.h gstreamer-1.12.5_new/gst/gstcaps.h
--- gstreamer-1.12.5/gst/gstcaps.h 2017-05-05 07:08:27.000000000 +0800
+++ gstreamer-1.12.5_new/gst/gstcaps.h 2023-12-22 18:59:40.196803997 +0800
@@ -222,6 +222,25 @@
gst_mini_object_unref (GST_MINI_OBJECT_CAST (caps));
}
+/**
+ * gst_clear_caps: (skip)
+ * @caps_ptr: a pointer to a #GstCaps reference
+ *
+ * Clears a reference to a #GstCaps.
+ *
+ * @caps_ptr must not be %NULL.
+ *
+ * If the reference is %NULL then this function does nothing. Otherwise, the
+ * reference count of the caps is decreased and the pointer is set to %NULL.
+ *
+ * Since: 1.16
+ */
+static inline void
+gst_clear_caps (GstCaps ** caps_ptr)
+{
+ gst_clear_mini_object (caps_ptr);
+}
+
/* copy caps */
/**
* gst_caps_copy: