mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-09 08:55:33 +00:00
gst: Initialize optional event/message fields when parsing
These might not exist inside the structure and then we would potentially keep around uninitialized memory from the caller in the out parameter. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1273>
This commit is contained in:
parent
39ad758fde
commit
3419ad9a45
2 changed files with 8 additions and 1 deletions
|
@ -1437,6 +1437,9 @@ gst_event_parse_seek_trickmode_interval (GstEvent * event,
|
||||||
g_return_if_fail (interval != NULL);
|
g_return_if_fail (interval != NULL);
|
||||||
g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_SEEK);
|
g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_SEEK);
|
||||||
|
|
||||||
|
if (interval)
|
||||||
|
*interval = GST_CLOCK_TIME_NONE;
|
||||||
|
|
||||||
gst_structure_id_get (GST_EVENT_STRUCTURE (event),
|
gst_structure_id_get (GST_EVENT_STRUCTURE (event),
|
||||||
GST_QUARK (TRICKMODE_INTERVAL), GST_TYPE_CLOCK_TIME, interval, NULL);
|
GST_QUARK (TRICKMODE_INTERVAL), GST_TYPE_CLOCK_TIME, interval, NULL);
|
||||||
}
|
}
|
||||||
|
@ -1771,10 +1774,10 @@ gst_event_parse_stream (GstEvent * event, GstStream ** stream)
|
||||||
g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_STREAM_START);
|
g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_STREAM_START);
|
||||||
|
|
||||||
if (stream) {
|
if (stream) {
|
||||||
|
*stream = NULL;
|
||||||
gst_structure_id_get (GST_EVENT_STRUCTURE (event),
|
gst_structure_id_get (GST_EVENT_STRUCTURE (event),
|
||||||
GST_QUARK (STREAM), GST_TYPE_STREAM, stream, NULL);
|
GST_QUARK (STREAM), GST_TYPE_STREAM, stream, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1809,6 +1812,7 @@ gst_event_parse_stream_flags (GstEvent * event, GstStreamFlags * flags)
|
||||||
g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_STREAM_START);
|
g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_STREAM_START);
|
||||||
|
|
||||||
if (flags) {
|
if (flags) {
|
||||||
|
*flags = 0;
|
||||||
gst_structure_id_get (GST_EVENT_STRUCTURE (event),
|
gst_structure_id_get (GST_EVENT_STRUCTURE (event),
|
||||||
GST_QUARK (FLAGS), GST_TYPE_STREAM_FLAGS, flags, NULL);
|
GST_QUARK (FLAGS), GST_TYPE_STREAM_FLAGS, flags, NULL);
|
||||||
}
|
}
|
||||||
|
@ -1859,6 +1863,7 @@ gst_event_parse_group_id (GstEvent * event, guint * group_id)
|
||||||
FALSE);
|
FALSE);
|
||||||
|
|
||||||
if (group_id) {
|
if (group_id) {
|
||||||
|
*group_id = 0;
|
||||||
return gst_structure_id_get (GST_EVENT_STRUCTURE (event),
|
return gst_structure_id_get (GST_EVENT_STRUCTURE (event),
|
||||||
GST_QUARK (GROUP_ID), G_TYPE_UINT, group_id, NULL);
|
GST_QUARK (GROUP_ID), G_TYPE_UINT, group_id, NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2470,6 +2470,8 @@ gst_message_parse_group_id (GstMessage * message, guint * group_id)
|
||||||
if (!group_id)
|
if (!group_id)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
*group_id = 0;
|
||||||
|
|
||||||
structure = GST_MESSAGE_STRUCTURE (message);
|
structure = GST_MESSAGE_STRUCTURE (message);
|
||||||
|
|
||||||
v = gst_structure_id_get_value (structure, GST_QUARK (GROUP_ID));
|
v = gst_structure_id_get_value (structure, GST_QUARK (GROUP_ID));
|
||||||
|
|
Loading…
Reference in a new issue