mirror of https://github.com/mpv-player/mpv
demux_playlist: don't add base path to self-expanding protocols
Adding base path make sense only if it is a real directory or url location. In case of protocols like memory adding base path to playlist entry in facts adds the whole playlist to that entry. For example `mpv $'memory://#EXTM3U\na/b'` produces infinite loop, expanding playlist, adding more to it. open_file adds the dirname to support relative playlist enties, however, the dirname is invalid when the name doesn't represent a path, such as with memory://..., so avoid taking the dirname with such protocols. Found by OSS-Fuzz.
This commit is contained in:
parent
529450a965
commit
2b1e9a6537
|
@ -563,8 +563,15 @@ static int open_file(struct demuxer *demuxer, enum demux_check check)
|
|||
p->utf16 = stream_skip_bom(p->s);
|
||||
p->opts = mp_get_config_group(demuxer, demuxer->global, &demux_playlist_conf);
|
||||
bool ok = fmt->parse(p) >= 0 && !p->error;
|
||||
if (p->add_base)
|
||||
playlist_add_base_path(p->pl, mp_dirname(demuxer->filename));
|
||||
if (p->add_base) {
|
||||
bstr proto = mp_split_proto(bstr0(demuxer->filename), NULL);
|
||||
// Don't add base path to self-expanding protocols
|
||||
if (bstrcasecmp0(proto, "memory") && bstrcasecmp0(proto, "lavf") &&
|
||||
bstrcasecmp0(proto, "hex"))
|
||||
{
|
||||
playlist_add_base_path(p->pl, mp_dirname(demuxer->filename));
|
||||
}
|
||||
}
|
||||
playlist_set_stream_flags(p->pl, demuxer->stream_origin);
|
||||
demuxer->playlist = talloc_steal(demuxer, p->pl);
|
||||
demuxer->filetype = p->format ? p->format : fmt->name;
|
||||
|
|
Loading…
Reference in New Issue