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

Rémi Denis-Courmont git at videolan.org
Wed Sep 30 20:53:05 CEST 2020


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Sep 29 20:53:53 2020 +0300| [b0a95683de9564abe3e85aa0f23294d34c6f55ef] | 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=b0a95683de9564abe3e85aa0f23294d34c6f55ef
---

 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..f62b134c69 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 = false;
+    else
+        match = true;
+
+    free(type);
+
+    if (!match)
         return VLC_EGENERIC;
 
     msg_Dbg( p_stream, "found valid M3U playlist" );



More information about the vlc-commits mailing list