diff --git a/fuzzers/fuzzer_load.c b/fuzzers/fuzzer_load.c
index 7f88d6c69c..fd44a9bc6d 100644
--- a/fuzzers/fuzzer_load.c
+++ b/fuzzers/fuzzer_load.c
@@ -57,10 +57,19 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
check_error(mpv_initialize(ctx));
- const char *cmd[] = {"load-" MPV_LOAD, filename, NULL};
+ const char *cmd[] = {"load" MPV_LOAD, filename, NULL};
check_error(mpv_command(ctx, cmd));
+#ifdef MPV_LOADFILE
+ while (1) {
+ mpv_event *event = mpv_wait_event(ctx, 10000);
+ if (event->event_id == MPV_EVENT_IDLE)
+ break;
+ }
+#endif
+
mpv_terminate_destroy(ctx);
+ unlink(filename);
return 0;
}
diff --git a/fuzzers/fuzzer_loadfile.c b/fuzzers/fuzzer_loadfile.c
deleted file mode 100644
index c2b1b92e5c..0000000000
--- a/fuzzers/fuzzer_loadfile.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * This file is part of mpv.
- *
- * mpv is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * mpv is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with mpv. If not, see .
- */
-
-#include
-#include
-#include
-
-#include
-
-#include
-
-#include "common.h"
-
-int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
-{
- if (size == 0)
- return -1;
-
- char filename[15 + 10 + 1];
- sprintf(filename, "/tmp/libfuzzer.%d", getpid());
-
- FILE *fp = fopen(filename, "wb");
- if (!fp)
- exit(1);
-
- if (fwrite(data, size, 1, fp) != 1)
- exit(1);
-
- if (fclose(fp))
- exit(1);
-
- mpv_handle *ctx = mpv_create();
- if (!ctx)
- exit(1);
-
- check_error(mpv_set_option_string(ctx, "vo", "null"));
- check_error(mpv_set_option_string(ctx, "ao", "null"));
- 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, "video-osd", "no"));
- check_error(mpv_set_option_string(ctx, "msg-level", "all=trace"));
- check_error(mpv_set_option_string(ctx, "network-timeout", "1"));
-
- check_error(mpv_initialize(ctx));
-
- const char *cmd[] = {"loadfile", filename, NULL};
- check_error(mpv_command(ctx, cmd));
-
- while (1) {
- mpv_event *event = mpv_wait_event(ctx, 10000);
- if (event->event_id == MPV_EVENT_IDLE)
- break;
- }
-
- mpv_terminate_destroy(ctx);
-
- return 0;
-}
diff --git a/fuzzers/meson.build b/fuzzers/meson.build
index e8733434a1..1ad98361e4 100644
--- a/fuzzers/meson.build
+++ b/fuzzers/meson.build
@@ -1,7 +1,5 @@
incdir = include_directories('../')
-executable('fuzzer_loadfile', 'fuzzer_loadfile.c',
- include_directories: incdir, link_with: libmpv)
executable('fuzzer_loadfile_direct', 'fuzzer_loadfile_direct.c',
include_directories: incdir, link_with: libmpv)
@@ -43,10 +41,10 @@ foreach f : ['MPV_FORMAT_STRING', 'MPV_FORMAT_FLAG', 'MPV_FORMAT_INT64', 'MPV_FO
endforeach
endforeach
-foreach cmd : ['config-file', 'input-conf']
- executable('fuzzer_load_' + cmd.underscorify(),
+foreach cmd : ['file', '-config-file', '-input-conf']
+ executable('fuzzer_load' + cmd.underscorify(),
'fuzzer_load.c',
- c_args: ['-DMPV_LOAD="' + cmd + '"'],
+ c_args: ['-DMPV_LOAD="' + cmd + '"', '-DMPV_LOAD' + cmd.underscorify().to_upper()],
include_directories: incdir,
link_with: libmpv)
endforeach