From 66fdec8a67a81afa21f26671eda3d503b95dad6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Wed, 10 Jul 2024 20:02:53 +0200 Subject: [PATCH] demux_edl: don't try to extract dirname from self-expanding protocols Fixes infinite recursion. Trying to extract dirname from string of memory:// is not really a good idea. Found by OSS-Fuzz. --- demux/demux_edl.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/demux/demux_edl.c b/demux/demux_edl.c index 1544873965..96f76c9066 100644 --- a/demux/demux_edl.c +++ b/demux/demux_edl.c @@ -567,8 +567,13 @@ error: static void fix_filenames(struct tl_parts *parts, char *source_path) { - if (!bstrcasecmp0(mp_split_proto(bstr0(source_path), NULL), "edl")) + bstr proto = mp_split_proto(bstr0(source_path), NULL); + // Don't adjust self-expanding protocols + if (!bstrcasecmp0(proto, "memory") || !bstrcasecmp0(proto, "lavf") || + !bstrcasecmp0(proto, "hex") || !bstrcasecmp0(proto, "edl")) + { return; + } struct bstr dirname = mp_dirname(source_path); for (int n = 0; n < parts->num_parts; n++) { struct tl_part *part = &parts->parts[n];