mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-31 19:42:26 +00:00
gstutils: check uri before using it in gst_pad_create_stream_id_internal
If an element implements wrongly the URI query and set the uri to NULL and if the element calls gst_pad_create_stream_id at some point, it will lead to crash as the uri is not supposed to be NULL in the gst_pad_create_stream_id_internal function. https://bugzilla.gnome.org/show_bug.cgi?id=744520
This commit is contained in:
parent
025c8343f2
commit
ee9ca5d48b
1 changed files with 5 additions and 3 deletions
|
@ -3675,15 +3675,17 @@ gst_pad_create_stream_id_internal (GstPad * pad, GstElement * parent,
|
||||||
* here is for source elements */
|
* here is for source elements */
|
||||||
if (!upstream_stream_id) {
|
if (!upstream_stream_id) {
|
||||||
GstQuery *query;
|
GstQuery *query;
|
||||||
|
gchar *uri = NULL;
|
||||||
|
|
||||||
/* Try to generate one from the URI query and
|
/* Try to generate one from the URI query and
|
||||||
* if it fails take a random number instead */
|
* if it fails take a random number instead */
|
||||||
query = gst_query_new_uri ();
|
query = gst_query_new_uri ();
|
||||||
if (gst_element_query (parent, query)) {
|
if (gst_element_query (parent, query)) {
|
||||||
GChecksum *cs;
|
|
||||||
gchar *uri;
|
|
||||||
|
|
||||||
gst_query_parse_uri (query, &uri);
|
gst_query_parse_uri (query, &uri);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (uri) {
|
||||||
|
GChecksum *cs;
|
||||||
|
|
||||||
/* And then generate an SHA256 sum of the URI */
|
/* And then generate an SHA256 sum of the URI */
|
||||||
cs = g_checksum_new (G_CHECKSUM_SHA256);
|
cs = g_checksum_new (G_CHECKSUM_SHA256);
|
||||||
|
|
Loading…
Reference in a new issue