From 0e98b2ad8ec00d3995051f2a9bfb5a5b268704e0 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 20 Dec 2019 09:55:47 +0100 Subject: edl: accept arbitrary paths Until now, .edl files accepted only "simple" filenames, i.e. no relative or absolute paths, no URLs. Now that the origin bullshit is a bit cleaned up and enforced in the EDL code, there's absolutely no reason to keep this. The new code behaves somewhat similar to playlists. (Although playlists are special because they're not truly recursively opened.) --- DOCS/edl-mpv.rst | 3 --- demux/demux_edl.c | 17 ----------------- 2 files changed, 20 deletions(-) diff --git a/DOCS/edl-mpv.rst b/DOCS/edl-mpv.rst index c5771c2bca..46a25293aa 100644 --- a/DOCS/edl-mpv.rst +++ b/DOCS/edl-mpv.rst @@ -254,6 +254,3 @@ header, the syntax is exactly the same. It's far more convenient to use ``;`` instead of line breaks, but that is orthogonal. Example: ``edl://f1.mkv,length=5,start=10;f2.mkv,30,20;f3.mkv`` - -As a quirks, mpv will accept arbitrary paths in EDLs originating from -``edl://``, while ``.edl`` does not. This makes no sense. diff --git a/demux/demux_edl.c b/demux/demux_edl.c index b1f268ad8b..36e74de5a6 100644 --- a/demux/demux_edl.c +++ b/demux/demux_edl.c @@ -61,7 +61,6 @@ struct tl_root { struct priv { bstr data; - bool allow_any; }; // Parse a time (absolute file time or duration). Currently equivalent to a @@ -398,18 +397,6 @@ error: return NULL; } -// For security, don't allow relative or absolute paths, only plain filenames. -// Also, make these filenames relative to the edl source file. -static void fix_filenames(struct tl_parts *parts, char *source_path) -{ - struct bstr dirname = mp_dirname(source_path); - for (int n = 0; n < parts->num_parts; n++) { - struct tl_part *part = &parts->parts[n]; - char *filename = mp_basename(part->filename); // plain filename only - part->filename = mp_path_join_bstr(parts, dirname, bstr0(filename)); - } -} - static void build_mpv_edl_timeline(struct timeline *tl) { struct priv *p = tl->demuxer->priv; @@ -426,8 +413,6 @@ static void build_mpv_edl_timeline(struct timeline *tl) for (int n = 0; n < root->num_pars; n++) { struct tl_parts *parts = root->pars[n]; - if (!p->allow_any) - fix_filenames(parts, tl->demuxer->filename); struct timeline_par *par = build_timeline(tl, parts); if (!par) break; @@ -459,8 +444,6 @@ static int try_open_file(struct demuxer *demuxer, enum demux_check check) struct stream *s = demuxer->stream; if (s->info && strcmp(s->info->name, "edl") == 0) { p->data = bstr0(s->path); - // Source is edl:// and not .edl => allow arbitrary paths - p->allow_any = true; return 0; } if (check >= DEMUX_CHECK_UNSAFE) { -- cgit v1.2.3