[vlc-commits] playlist: xspf: revert to unrolling on multiple attributes (fix #19755)
vlc/vlc-3.0 | branch: master | Francois Cartegnie | Mon Feb 19 18:04:10 2018 +0100| [e7d5f26c25fc26d42bb2877032f0f7c77e1cccfd] | committer: Francois Cartegnie playlist: xspf: revert to unrolling on multiple attributes (fix #19755) regression in e21706e9e3bdc13cfe33bd292ba7cddcc3954ee6 (cherry picked from commit c7b8f7b43119d632ce3539cf0a48b10320b4708e) > http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=e7d5f26c25fc26d42bb2877032f0f7c77e1cccfd --- modules/demux/playlist/xspf.c | 36 ++-- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/modules/demux/playlist/xspf.c b/modules/demux/playlist/xspf.c index 72884d056d..5800cc3b0e 100644 --- a/modules/demux/playlist/xspf.c +++ b/modules/demux/playlist/xspf.c @@ -314,24 +314,30 @@ static bool parse_playlist_node COMPLEX_INTERFACE if(b_empty_node) return false; +bool b_version_found = false; /* read all playlist attributes */ -const char *psz_version = get_node_attribute(p_xml_reader, "version"); -if(!psz_version || (strcmp(psz_version, "0") && strcmp(psz_version, "1"))) +const char *psz_name, *psz_value; +while ((psz_name = xml_ReaderNextAttr(p_xml_reader, &psz_value)) != NULL) { -/* attribute version is mandatory !!! */ -if(!psz_version) -msg_Warn(p_stream, " requires \"version\" attribute"); +if (!strcmp(psz_name, "version")) +{ +b_version_found = true; +if (strcmp(psz_value, "0") && strcmp(psz_value, "1")) +msg_Warn(p_stream, "unsupported XSPF version %s", psz_value); +} +else if (!strcmp(psz_name, "xmlns") || !strcmp(psz_name, "xmlns:vlc")) +; +else if (!strcmp(psz_name, "xml:base")) +{ +free(sys->psz_base); +sys->psz_base = strdup(psz_value); +} else -msg_Warn(p_stream, "unsupported XSPF version %s", psz_version); -return false; -} - -const char *psz_base = get_node_attribute(p_xml_reader, "xml:base"); -if(psz_base) -{ -free(sys->psz_base); -sys->psz_base = strdup(psz_base); +msg_Warn(p_stream, "invalid attribute: \"%s\"", psz_name); } +/* attribute version is mandatory !!! */ +if (!b_version_found) +msg_Warn(p_stream, " requires \"version\" attribute"); static const xml_elem_hnd_t pl_elements[] = { {"title",{.smpl = set_item_info}, false }, @@ -620,6 +626,7 @@ static bool parse_extension_node COMPLEX_INTERFACE if(b_empty_node) return false; +/* read all extension node attributes */ const char *psz_application = get_node_attribute(p_xml_reader, "application"); if (!psz_application) { @@ -661,6 +668,7 @@ static bool parse_extitem_node COMPLEX_INTERFACE if(!b_empty_node) return false; +/* read all extension node attributes */ const char *psz_tid = get_node_attribute(p_xml_reader, "tid"); if(psz_tid) i_tid = atoi(psz_tid); ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] playlist: xspf: revert to unrolling on multiple attributes (fix #19755)
vlc | branch: master | Francois Cartegnie | Mon Feb 19 18:04:10 2018 +0100| [c7b8f7b43119d632ce3539cf0a48b10320b4708e] | committer: Francois Cartegnie playlist: xspf: revert to unrolling on multiple attributes (fix #19755) regression in e21706e9e3bdc13cfe33bd292ba7cddcc3954ee6 > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c7b8f7b43119d632ce3539cf0a48b10320b4708e --- modules/demux/playlist/xspf.c | 36 ++-- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/modules/demux/playlist/xspf.c b/modules/demux/playlist/xspf.c index 97f9747596..dc4c105d9a 100644 --- a/modules/demux/playlist/xspf.c +++ b/modules/demux/playlist/xspf.c @@ -314,24 +314,30 @@ static bool parse_playlist_node COMPLEX_INTERFACE if(b_empty_node) return false; +bool b_version_found = false; /* read all playlist attributes */ -const char *psz_version = get_node_attribute(p_xml_reader, "version"); -if(!psz_version || (strcmp(psz_version, "0") && strcmp(psz_version, "1"))) +const char *psz_name, *psz_value; +while ((psz_name = xml_ReaderNextAttr(p_xml_reader, &psz_value)) != NULL) { -/* attribute version is mandatory !!! */ -if(!psz_version) -msg_Warn(p_stream, " requires \"version\" attribute"); +if (!strcmp(psz_name, "version")) +{ +b_version_found = true; +if (strcmp(psz_value, "0") && strcmp(psz_value, "1")) +msg_Warn(p_stream, "unsupported XSPF version %s", psz_value); +} +else if (!strcmp(psz_name, "xmlns") || !strcmp(psz_name, "xmlns:vlc")) +; +else if (!strcmp(psz_name, "xml:base")) +{ +free(sys->psz_base); +sys->psz_base = strdup(psz_value); +} else -msg_Warn(p_stream, "unsupported XSPF version %s", psz_version); -return false; -} - -const char *psz_base = get_node_attribute(p_xml_reader, "xml:base"); -if(psz_base) -{ -free(sys->psz_base); -sys->psz_base = strdup(psz_base); +msg_Warn(p_stream, "invalid attribute: \"%s\"", psz_name); } +/* attribute version is mandatory !!! */ +if (!b_version_found) +msg_Warn(p_stream, " requires \"version\" attribute"); static const xml_elem_hnd_t pl_elements[] = { {"title",{.smpl = set_item_info}, false }, @@ -620,6 +626,7 @@ static bool parse_extension_node COMPLEX_INTERFACE if(b_empty_node) return false; +/* read all extension node attributes */ const char *psz_application = get_node_attribute(p_xml_reader, "application"); if (!psz_application) { @@ -661,6 +668,7 @@ static bool parse_extitem_node COMPLEX_INTERFACE if(!b_empty_node) return false; +/* read all extension node attributes */ const char *psz_tid = get_node_attribute(p_xml_reader, "tid"); if(psz_tid) i_tid = atoi(psz_tid); ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits