[vlc-commits] demux/playlist: xspf: fix skip of unknown <extension>

Filip Roséen git at videolan.org
Thu May 18 18:08:50 CEST 2017


vlc | branch: master | Filip Roséen <filip at atch.se> | Thu May 18 12:08:21 2017 +0200| [e97622e3b0fc775323bd56e0e3d7d98abbefb96e] | committer: Rémi Denis-Courmont

demux/playlist: xspf: fix skip of unknown <extension>

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

Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e97622e3b0fc775323bd56e0e3d7d98abbefb96e
---

 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;
         }
 



More information about the vlc-commits mailing list