From 5995f13b5fbb0e98bb05e3ec9f9d874777f122d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Tue, 25 Jun 2024 17:13:56 +0200 Subject: [PATCH] fuzzer_set_property: fix setting audio-files list `:` were not escaped correctly. Also while at it clear other external file lists, as we don't want to load any. Subtitle fuzzer will be added in the future. It is surprisingly hard to clear the list with C API. That needs whole mpv_node_list with 0 elements, to make it clear it. --- fuzzers/fuzzer_set_property.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/fuzzers/fuzzer_set_property.c b/fuzzers/fuzzer_set_property.c index dc14e6518e..f8b00722c1 100644 --- a/fuzzers/fuzzer_set_property.c +++ b/fuzzers/fuzzer_set_property.c @@ -79,11 +79,29 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) #if MPV_RUN check_error(mpv_set_option_string(ctx, "ao-null-untimed", "yes")); - check_error(mpv_set_option_string(ctx, "untimed", "yes")); + check_error(mpv_set_option_string(ctx, "loop-file", "no")); + check_error(mpv_set_option_string(ctx, "loop-playlist", "no")); check_error(mpv_set_option_string(ctx, "pause", "no")); + check_error(mpv_set_option_string(ctx, "untimed", "yes")); - check_error(mpv_set_option_string(ctx, "audio-files", "av://lavfi:sine=d=0.1")); - const char *cmd[] = {"loadfile", "av://lavfi:yuvtestsrc=d=0.1", NULL}; + mpv_node node = { + .format = MPV_FORMAT_NODE_ARRAY, + .u.list = &(mpv_node_list) { + .num = 1, + .values = &(mpv_node) { + .format = MPV_FORMAT_STRING, + .u.string = "av://lavfi:sine=d=0.01", + }, + }, + }; + check_error(mpv_set_option(ctx, "audio-files", MPV_FORMAT_NODE, &node)); + + node.u.list->num = 0; + check_error(mpv_set_option(ctx, "cover-art-files", MPV_FORMAT_NODE, &node)); + check_error(mpv_set_option(ctx, "external-files", MPV_FORMAT_NODE, &node)); + check_error(mpv_set_option(ctx, "sub-files", MPV_FORMAT_NODE, &node)); + + const char *cmd[] = {"loadfile", "av://lavfi:yuvtestsrc=d=0.01", NULL}; check_error(mpv_command(ctx, cmd)); while (1) {