[vlc-commits] demux: itml: fix false positive with xml files

Francois Cartegnie git at videolan.org
Wed Oct 7 18:56:56 CEST 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Sep 11 15:18:41 2015 +0200| [8acf172fb3df57ff1790aefe9971e4ee582c8319] | committer: Francois Cartegnie

demux: itml: fix false positive with xml files

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

 modules/demux/playlist/itml.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/modules/demux/playlist/itml.c b/modules/demux/playlist/itml.c
index e000ec3..44f0883 100644
--- a/modules/demux/playlist/itml.c
+++ b/modules/demux/playlist/itml.c
@@ -34,6 +34,7 @@
 #include <vlc_xml.h>
 #include <vlc_strings.h>
 #include <vlc_url.h>
+#include <vlc_fixups.h>
 
 #include "itml.h"
 #include "playlist.h"
@@ -52,6 +53,14 @@ int Import_iTML( vlc_object_t *p_this )
 {
     DEMUX_BY_EXTENSION_OR_FORCED_MSG( ".xml", "itml",
                                       "using iTunes Media Library reader" );
+    const uint8_t *p_peek;
+    const uint64_t i_peek = stream_Peek( p_demux->s, &p_peek, 128 );
+    if ( i_peek < 32 ||
+         !strnstr( (const char *) p_peek, "<!DOCTYPE plist ", i_peek ) )
+    {
+        Close_iTML( p_this );
+        return VLC_EGENERIC;
+    }
     return VLC_SUCCESS;
 }
 



More information about the vlc-commits mailing list