mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-02 21:48:55 +00:00
dashdemux: fixed segfault for missing default namespace
Added a check for a_node->ns before accessing a_node->ns->href in gst_mpdparser_get_xml_node_namespace. This could happen if the xml is missing the default namespace. https://bugzilla.gnome.org/show_bug.cgi?id=750866
This commit is contained in:
parent
62f25894a5
commit
b23e4452a2
2 changed files with 27 additions and 3 deletions
|
@ -958,10 +958,12 @@ gst_mpdparser_get_xml_node_namespace (xmlNode * a_node, const gchar * prefix)
|
||||||
|
|
||||||
if (prefix == NULL) {
|
if (prefix == NULL) {
|
||||||
/* return the default namespace */
|
/* return the default namespace */
|
||||||
|
if (a_node->ns) {
|
||||||
namespace = xmlMemStrdup ((const gchar *) a_node->ns->href);
|
namespace = xmlMemStrdup ((const gchar *) a_node->ns->href);
|
||||||
if (namespace) {
|
if (namespace) {
|
||||||
GST_LOG (" - default namespace: %s", namespace);
|
GST_LOG (" - default namespace: %s", namespace);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
/* look for the specified prefix in the namespace list */
|
/* look for the specified prefix in the namespace list */
|
||||||
for (curr_ns = a_node->ns; curr_ns; curr_ns = curr_ns->next) {
|
for (curr_ns = a_node->ns; curr_ns; curr_ns = curr_ns->next) {
|
||||||
|
|
|
@ -412,6 +412,27 @@ GST_START_TEST (dash_mpdparser_no_end_tag)
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test parsing an MPD with no default namespace
|
||||||
|
*/
|
||||||
|
GST_START_TEST (dash_mpdparser_no_default_namespace)
|
||||||
|
{
|
||||||
|
const gchar *xml =
|
||||||
|
"<?xml version=\"1.0\"?>"
|
||||||
|
"<MPD profiles=\"urn:mpeg:dash:profile:isoff-main:2011\"></MPD>";
|
||||||
|
|
||||||
|
gboolean ret;
|
||||||
|
GstMpdClient *mpdclient = gst_mpd_client_new ();
|
||||||
|
|
||||||
|
ret = gst_mpd_parse (mpdclient, xml, strlen (xml));
|
||||||
|
|
||||||
|
assert_equals_int (ret, TRUE);
|
||||||
|
|
||||||
|
gst_mpd_client_free (mpdclient);
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_END_TEST;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* create a test suite containing all dash testcases
|
* create a test suite containing all dash testcases
|
||||||
*/
|
*/
|
||||||
|
@ -444,6 +465,7 @@ dash_suite (void)
|
||||||
tcase_add_test (tc_negativeTests, dash_mpdparser_missing_xml);
|
tcase_add_test (tc_negativeTests, dash_mpdparser_missing_xml);
|
||||||
tcase_add_test (tc_negativeTests, dash_mpdparser_missing_mpd);
|
tcase_add_test (tc_negativeTests, dash_mpdparser_missing_mpd);
|
||||||
tcase_add_test (tc_negativeTests, dash_mpdparser_no_end_tag);
|
tcase_add_test (tc_negativeTests, dash_mpdparser_no_end_tag);
|
||||||
|
tcase_add_test (tc_negativeTests, dash_mpdparser_no_default_namespace);
|
||||||
|
|
||||||
suite_add_tcase (s, tc_simpleMPD);
|
suite_add_tcase (s, tc_simpleMPD);
|
||||||
suite_add_tcase (s, tc_negativeTests);
|
suite_add_tcase (s, tc_negativeTests);
|
||||||
|
|
Loading…
Reference in a new issue