From a3656ba29bc397db57f1e06b129d839830379af0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 2 May 2017 14:31:14 +0300 Subject: [PATCH] libs: Check if meta transform_func is NULL before using it https://bugzilla.gnome.org/show_bug.cgi?id=782050 --- gst-libs/gst/audio/gstaudiodecoder.c | 2 +- gst-libs/gst/audio/gstaudioencoder.c | 2 +- gst-libs/gst/rtp/gstrtpbaseaudiopayload.c | 6 +++--- gst-libs/gst/video/gstvideodecoder.c | 2 +- gst-libs/gst/video/gstvideoencoder.c | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gst-libs/gst/audio/gstaudiodecoder.c b/gst-libs/gst/audio/gstaudiodecoder.c index ffaf48f1a8..333dbf9ebf 100644 --- a/gst-libs/gst/audio/gstaudiodecoder.c +++ b/gst-libs/gst/audio/gstaudiodecoder.c @@ -1166,7 +1166,7 @@ foreach_metadata (GstBuffer * inbuf, GstMeta ** meta, gpointer user_data) /* we only copy metadata when the subclass implemented a transform_meta * function and when it returns %TRUE */ - if (do_copy) { + if (do_copy && info->transform_func) { GstMetaTransformCopy copy_data = { FALSE, 0, -1 }; GST_DEBUG_OBJECT (decoder, "copy metadata %s", g_type_name (info->api)); /* simply copy then */ diff --git a/gst-libs/gst/audio/gstaudioencoder.c b/gst-libs/gst/audio/gstaudioencoder.c index 0b84f0bdea..5c3b97bae2 100644 --- a/gst-libs/gst/audio/gstaudioencoder.c +++ b/gst-libs/gst/audio/gstaudioencoder.c @@ -696,7 +696,7 @@ foreach_metadata (GstBuffer * inbuf, GstMeta ** meta, gpointer user_data) /* we only copy metadata when the subclass implemented a transform_meta * function and when it returns %TRUE */ - if (do_copy) { + if (do_copy && info->transform_func) { GstMetaTransformCopy copy_data = { FALSE, 0, -1 }; GST_DEBUG_OBJECT (encoder, "copy metadata %s", g_type_name (info->api)); /* simply copy then */ diff --git a/gst-libs/gst/rtp/gstrtpbaseaudiopayload.c b/gst-libs/gst/rtp/gstrtpbaseaudiopayload.c index e5b1d7edac..dd6789a506 100644 --- a/gst-libs/gst/rtp/gstrtpbaseaudiopayload.c +++ b/gst-libs/gst/rtp/gstrtpbaseaudiopayload.c @@ -492,9 +492,9 @@ foreach_metadata (GstBuffer * inbuf, GstMeta ** meta, gpointer user_data) const GstMetaInfo *info = (*meta)->info; const gchar *const *tags = gst_meta_api_type_get_tags (info->api); - if (!tags || (g_strv_length ((gchar **) tags) == 1 - && gst_meta_api_type_has_tag (info->api, - g_quark_from_string (GST_META_TAG_AUDIO_STR)))) { + if (info->transform_func && (!tags || (g_strv_length ((gchar **) tags) == 1 + && gst_meta_api_type_has_tag (info->api, + g_quark_from_string (GST_META_TAG_AUDIO_STR))))) { GstMetaTransformCopy copy_data = { FALSE, 0, -1 }; GST_DEBUG_OBJECT (pay, "copy metadata %s", g_type_name (info->api)); /* simply copy then */ diff --git a/gst-libs/gst/video/gstvideodecoder.c b/gst-libs/gst/video/gstvideodecoder.c index 0a21e46c60..b91a32e79f 100644 --- a/gst-libs/gst/video/gstvideodecoder.c +++ b/gst-libs/gst/video/gstvideodecoder.c @@ -2932,7 +2932,7 @@ foreach_metadata (GstBuffer * inbuf, GstMeta ** meta, gpointer user_data) /* we only copy metadata when the subclass implemented a transform_meta * function and when it returns %TRUE */ - if (do_copy) { + if (do_copy && info->transform_func) { GstMetaTransformCopy copy_data = { FALSE, 0, -1 }; GST_DEBUG_OBJECT (decoder, "copy metadata %s", g_type_name (info->api)); /* simply copy then */ diff --git a/gst-libs/gst/video/gstvideoencoder.c b/gst-libs/gst/video/gstvideoencoder.c index b4ae5982dc..f2bd5311a2 100644 --- a/gst-libs/gst/video/gstvideoencoder.c +++ b/gst-libs/gst/video/gstvideoencoder.c @@ -1892,7 +1892,7 @@ foreach_metadata (GstBuffer * inbuf, GstMeta ** meta, gpointer user_data) /* we only copy metadata when the subclass implemented a transform_meta * function and when it returns %TRUE */ - if (do_copy) { + if (do_copy && info->transform_func) { GstMetaTransformCopy copy_data = { FALSE, 0, -1 }; GST_DEBUG_OBJECT (encoder, "copy metadata %s", g_type_name (info->api)); /* simply copy then */