[vlc-commits] m3u: reintroduce extension and content type checks

Rémi Denis-Courmont git at videolan.org
Wed Sep 30 19:57:30 CEST 2020


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Sep 29 20:53:53 2020 +0300| [c89210e84288ab50433e4eddcc04363b06ef8aef] | committer: Rémi Denis-Courmont

m3u: reintroduce extension and content type checks

This partially reverts commit 0b67edc914a9678ad5ab74e3bc0bd5d68f4da46b.

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

 modules/demux/playlist/m3u.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/modules/demux/playlist/m3u.c b/modules/demux/playlist/m3u.c
index 038e2077d1..d92a3d5315 100644
--- a/modules/demux/playlist/m3u.c
+++ b/modules/demux/playlist/m3u.c
@@ -83,11 +83,30 @@ int Import_M3U( vlc_object_t *p_this )
         i_peek -= offset;
     }
 
+    /* File type: playlist, or not (HLS manifest or whatever else) */
+    char *type = stream_MimeType(p_stream->s);
+    bool match;
+
     if (!p_stream->obj.force
      && memcmp(p_peek, "#EXTM3U", 7 ) != 0
+     && (type == NULL
+      || (vlc_ascii_strcasecmp(type, "application/mpegurl") != 0
+       && vlc_ascii_strcasecmp(type, "application/x-mpegurl") != 0
+       && vlc_ascii_strcasecmp(type, "audio/mpegurl") != 0
+       && vlc_ascii_strcasecmp(type, "vnd.apple.mpegURL") != 0
+       && vlc_ascii_strcasecmp(type, "audio/x-mpegurl") != 0))
+     && !stream_HasExtension(p_stream, ".m3u8")
+     && !stream_HasExtension(p_stream, ".m3u")
      && !stream_HasExtension(p_stream, ".vlc")
      && strncasecmp((const char *)p_peek, "RTSPtext", 8) != 0
      && !ContainsURL(p_peek, i_peek))
+        match = true;
+    else
+        match = false;
+
+    free(type);
+
+    if (!match)
         return VLC_EGENERIC;
 
     msg_Dbg( p_stream, "found valid M3U playlist" );



More information about the vlc-commits mailing list