[vlc-devel] [PATCH 3/9] demux/playlist: xspf: fix skip of unknown <extension>

Filip Roséen filip at atch.se
Thu May 18 12:08:21 CEST 2017


As a XML_READER_STARTELEM does not have a corresponding
XML_READER_ENDELEM if the tag is self-closing, the code responsible
for skipping unknown extension-tags would result in skips outside of
the target element.

These changes fixes the issue by making sure that we do not increase
the ignore-scope for self-closing elements.

fixes: #18335
---
 modules/demux/playlist/xspf.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/modules/demux/playlist/xspf.c b/modules/demux/playlist/xspf.c
index e5d95eb51e..35c66978fb 100644
--- a/modules/demux/playlist/xspf.c
+++ b/modules/demux/playlist/xspf.c
@@ -646,14 +646,7 @@ static bool parse_extension_node COMPLEX_INTERFACE
             msg_Dbg(p_demux, "Skipping \"%s\" extension tag", psz_application);
             free(psz_application);
             free(psz_title);
-            /* Skip all children */
-            for (unsigned lvl = 1; lvl;)
-                switch (xml_ReaderNextNode(p_xml_reader, NULL))
-                {
-                    case XML_READER_STARTELEM: lvl++; break;
-                    case XML_READER_ENDELEM:   lvl--; break;
-                    case 0: case -1: return -1;
-                }
+            skip_element( NULL, NULL, p_xml_reader, NULL );
             return true;
         }
     }
@@ -812,8 +805,13 @@ static bool skip_element COMPLEX_INTERFACE
     for (unsigned lvl = 1; lvl;)
         switch (xml_ReaderNextNode(p_xml_reader, NULL))
         {
-            case XML_READER_STARTELEM: lvl++; break;
-            case XML_READER_ENDELEM:   lvl--; break;
+            case XML_READER_STARTELEM:
+            {
+                if( !xml_ReaderIsEmptyElement( p_xml_reader ) )
+                    ++lvl;
+                break;
+            }
+            case XML_READER_ENDELEM: lvl--; break;
             case 0: case -1: return false;
         }
 
-- 
2.12.2


More information about the vlc-devel mailing list