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: 96ef62161a
This commit is contained in:
Kacper Michajłow 2024-06-17 19:36:53 +02:00
parent 71d3f4157b
commit c194f2dc32
1 changed files with 4 additions and 4 deletions

View File

@ -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)