GNOME Bugzilla – Bug 723554
request for "stats" property of "payX" pipeline element may raise GLib warning
Last modified: 2014-02-25 22:28:17 UTC
In gst_rtsp_stream_get_rtpinfo () at rtsp-stream.c:1890 there is a request g_object_get (..., "stats", ...). The object on which this request is done is a GstElement in a pipeline given to gst_rtsp_media_factory_set_launch (), named payX and intended for pulling data from it to send to RTSP client. But there's no requirement declared that payX must be derived from GstRtpBasePayload class, which implements "stats" property. For example, in my application a pipeline provided to gst_rtsp_media_factory_set_launch () looks like this ( appsrc name=%s ! capsfilter name=capsfilter_%s ! identity name=pay%d ) When it is constructed, i save references to appsrc and capsfilter objects to be able to push data there and set actual caps. And this request for "stats" property makes app stop when G_DEBUG=all is set, which i use for debug purposes, with such message: GLib-GObject-WARNING **: g_object_get_valist: object class 'GstIdentity' has no property named 'stats' So could this be somehow enhanced so that property is not requested when it is not present? Or to make it so that ...get_rtpinfo () is not executed at all?
And when G_DEBUG is unset, this may result in crash: GLib-GObject-WARNING **: g_object_get_valist: object class 'GstIdentity' has no property named 'stats' *** glibc detected *** appname: free(): invalid pointer: 0x0000000000ad4a50 *** The reason is probably there: GstStructure *stats; ... g_object_get (priv->payloader, "stats", &stats, NULL); if (stats == NULL) goto no_stats; stats is not initialized to NULL, but checked against it. I guess g_object_set () does not modify/init it in any way, thus we check uninitialized value against NULL, which doesn't work.
When stats = NULL init added, there are still problems: rtpinfo string is subject to g_string_free() being NULL, which causes critical GLib warning.
+ Trace 233119
Created attachment 267999 [details] [review] patch fixing pointers handling fixes invalid pointer access, but not a warning about non-existing property.
commit 71c45fce5a50146ca799215874095679708872d3 Author: Wim Taymans <wtaymans@redhat.com> Date: Tue Feb 4 10:14:45 2014 +0100 stream: add fallback for missing stats property Use a fallback when the payloader does not have a stats property Fixes https://bugzilla.gnome.org/show_bug.cgi?id=723554
Created attachment 268104 [details] [review] another patch
Please apply the above patch, because a part of problem still wasn't fixed.
+ Trace 233130
commit 271f5330985fbf4b4e41028a43cc00788a0fcfff Author: Andrey Utkin <andrey.krieger.utkin@gmail.com> Date: Mon Feb 3 22:41:48 2014 +0200 Don't free rtpinfo GString when it is NULL Fixes https://bugzilla.gnome.org/show_bug.cgi?id=723554