From c194f2dc3253a3a0437b58d1dad7e8c4eefef076 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Mon, 17 Jun 2024 19:36:53 +0200 Subject: [PATCH] demux_edl: fix infinite loop on empty EDL files "file" is implicit key, it is always available, so we have to check if it is not empty. Found by OSS-Fuzz. Fixes: 96ef62161ac8edb3c111bde7a79cb07dd6db813c --- demux/demux_edl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/demux/demux_edl.c b/demux/demux_edl.c index 55af553661..1544873965 100644 --- a/demux/demux_edl.c +++ b/demux/demux_edl.c @@ -289,6 +289,10 @@ static struct tl_root *parse_edl(bstr str, struct mp_log *log) } else { struct tl_part p = { .length = -1 }; p.filename = get_param0(&ctx, tl, "file"); + if (!p.filename || !p.filename[0]) { + mp_err(log, "Missing filename in segment.'\n"); + goto error; + } p.offset_set = get_param_time(&ctx, "start", &p.offset); get_param_time(&ctx, "length", &p.length); bstr ts = get_param(&ctx, "timestamps"); @@ -306,10 +310,6 @@ static struct tl_root *parse_edl(bstr str, struct mp_log *log) mp_warn(log, "Unknown layout param: '%.*s'\n", BSTR_P(layout)); } } - if (!p.filename) { - mp_err(log, "Missing filename in segment.'\n"); - goto error; - } MP_TARRAY_APPEND(tl, tl->parts, tl->num_parts, p); } if (ctx.error)