diff options
author | Mathieu Duponchelle <mathieu@centricular.com> | 2020-09-16 02:16:52 +0200 |
---|---|---|
committer | GStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org> | 2020-09-18 17:31:22 +0000 |
commit | 3393b456e47f634cf571c647285611adf34a6d9f (patch) | |
tree | e42070bb99f6143d7f5b4762c10e6646012f616b /gst | |
parent | f26a9ebafb8c6d40b411fe5a412a4d463b26c8ae (diff) | |
download | gstreamer-3393b456e47f634cf571c647285611adf34a6d9f.tar.gz |
gstmeta: intern registered impl string
Subsequent lookups in the hashtable are probably better done
on memory we're confident is allocated to us :)
It was easy to trigger invalid reads by calling gst_meta_register
with dynamically allocated memory, freeing that memory, then
calling gst_meta_get_info()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/628>
Diffstat (limited to 'gst')
-rw-r--r-- | gst/gstmeta.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gst/gstmeta.c b/gst/gstmeta.c index c7c1f00290..ab36cefffd 100644 --- a/gst/gstmeta.c +++ b/gst/gstmeta.c @@ -198,7 +198,8 @@ gst_meta_register (GType api, const gchar * impl, gsize size, g_type_name (api), size); g_rw_lock_writer_lock (&lock); - g_hash_table_insert (metainfo, (gpointer) impl, (gpointer) info); + g_hash_table_insert (metainfo, (gpointer) g_intern_string (impl), + (gpointer) info); g_rw_lock_writer_unlock (&lock); return info; |