summaryrefslogtreecommitdiffstats
path: root/demux
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2023-08-14 21:22:15 -0500
committersfan5 <sfan5@live.de>2023-08-15 16:49:37 +0200
commit17eb928775a55f155d40a3cc4ccae67eec72edb8 (patch)
tree6b9e859ea668a3129081abe120c539490c06d52f /demux
parent9d7638a6f21dffe20c0d00df70087a3be90d2139 (diff)
downloadmpv-17eb928775a55f155d40a3cc4ccae67eec72edb8.tar.bz2
mpv-17eb928775a55f155d40a3cc4ccae67eec72edb8.tar.xz
demux_playlist: remove len restriction on headerless m3u
Discovered by @christoph-heinrich in IRC. 09c701b797c44293dc0e22874b4acf0246b3d148 added a fallback for headerless m3u files. However, it requires that the bstr len be greater than 10. This means that a m3u playlist with a single entry with a very short filename (such as "test.flac") will not be recognized as a playlist since the amount of data is too small. The reason for this restriction is unexplained and really shouldn't matter given that the important thing mpv should be doing is checking if the data is text. Instead, loosen the check so that it only needs to be 2 or greater. This covers a single byte filename and a line terminator.
Diffstat (limited to 'demux')
-rw-r--r--demux/demux_playlist.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/demux/demux_playlist.c b/demux/demux_playlist.c
index a99d8be7c8..0c55df9dd8 100644
--- a/demux/demux_playlist.c
+++ b/demux/demux_playlist.c
@@ -207,7 +207,7 @@ static int parse_m3u(struct pl_parser *p)
char probe[PROBE_SIZE];
int len = stream_read_peek(p->real_stream, probe, sizeof(probe));
bstr data = {probe, len};
- if (ext && data.len > 10 && maybe_text(data)) {
+ if (ext && data.len >= 2 && maybe_text(data)) {
const char *exts[] = {"m3u", "m3u8", NULL};
for (int n = 0; exts[n]; n++) {
if (strcasecmp(ext, exts[n]) == 0)