Use gst_element_class_set_metadata when passing dynamic strings
authorJordan Petridis <jpetridis@gnome.org>
Thu, 11 Jun 2020 17:39:33 +0000 (20:39 +0300)
committerJordan Petridis <jpetridis@gnome.org>
Thu, 11 Jun 2020 17:39:33 +0000 (20:39 +0300)
gst_element_class_set_metadata is meant to only be used with
static or inlined strings, which isn't the case for the 2 elements
here resulting in use-after-free later on.

https://gstreamer.freedesktop.org/documentation/gstreamer/gstelement.html?gi-language=c#gst_element_class_set_static_metadata

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/622>

gst/isomp4/gstqtmux.c
sys/v4l2/gstv4l2videodec.c

index 04a6cad..53124e1 100644 (file)
@@ -459,7 +459,7 @@ gst_qt_mux_base_init (gpointer g_class)
   longname = g_strdup_printf ("%s Muxer", params->prop->long_name);
   description = g_strdup_printf ("Multiplex audio and video into a %s file",
       params->prop->long_name);
-  gst_element_class_set_static_metadata (element_class, longname,
+  gst_element_class_set_metadata (element_class, longname,
       "Codec/Muxer", description,
       "Thiago Sousa Santos <thiagoss@embedded.ufcg.edu.br>");
   g_free (longname);
index 65a1d10..7f5d6fd 100644 (file)
@@ -1050,7 +1050,7 @@ gst_v4l2_video_dec_subclass_init (gpointer g_class, gpointer data)
       gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
           cdata->src_caps));
 
-  gst_element_class_set_static_metadata (element_class, cdata->longname,
+  gst_element_class_set_metadata (element_class, cdata->longname,
       "Codec/Decoder/Video/Hardware", cdata->description,
       "Nicolas Dufresne <nicolas.dufresne@collabora.com>");