From 15d92392b50504b0e8769db972d60944ea83117c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 16 Apr 2012 08:24:58 +0200 Subject: [PATCH] uridecodebin: Check that properties have the correct type before using them --- gst/playback/gsturidecodebin.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/gst/playback/gsturidecodebin.c b/gst/playback/gsturidecodebin.c index 94a5db765f..2aab32e80b 100644 --- a/gst/playback/gsturidecodebin.c +++ b/gst/playback/gsturidecodebin.c @@ -1235,10 +1235,13 @@ gen_source_element (GstURIDecodeBin * decoder) /* make HTTP sources send extra headers so we get icecast * metadata in case the stream is an icecast stream */ - if (!strncmp (decoder->uri, "http://", 7) && - g_object_class_find_property (source_class, "iradio-mode")) { - GST_LOG_OBJECT (decoder, "configuring iradio-mode"); - g_object_set (source, "iradio-mode", TRUE, NULL); + if (!strncmp (decoder->uri, "http://", 7)) { + pspec = g_object_class_find_property (source_class, "iradio-mode"); + + if (pspec && G_PARAM_SPEC_VALUE_TYPE (pspec) == G_TYPE_STRING) { + GST_LOG_OBJECT (decoder, "configuring iradio-mode"); + g_object_set (source, "iradio-mode", TRUE, NULL); + } } pspec = g_object_class_find_property (source_class, "connection-speed"); @@ -2014,9 +2017,11 @@ is_live_source (GstElement * source) { GObjectClass *source_class = NULL; gboolean is_live = FALSE; + GParamSpec *pspec; source_class = G_OBJECT_GET_CLASS (source); - if (!g_object_class_find_property (source_class, "is-live")) + pspec = g_object_class_find_property (source_class, "is-live"); + if (!pspec || G_PARAM_SPEC_VALUE_TYPE (pspec) != G_TYPE_BOOLEAN) return FALSE; g_object_get (G_OBJECT (source), "is-live", &is_live, NULL);