fuzzer_load: disallow include option in config files

It produces undeterministic results, especially if it do
`include=fd://N` which starts loading external data.
This commit is contained in:
Kacper Michajłow 2024-06-22 18:42:47 +02:00
parent b4123826e5
commit c3de4f04db
1 changed files with 5 additions and 0 deletions

View File

@ -28,6 +28,11 @@
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{ {
#if defined(MPV_LOAD_CONFIG_FILE) || defined(MPV_LOAD_INPUT_CONF)
if (memmem(data, size, "include", sizeof("include") - 1))
return 0;
#endif
// fmemopen doesn't have associated file descriptor, so we do copy. // fmemopen doesn't have associated file descriptor, so we do copy.
int fd = memfd_create("fuzz_mpv_load", 0); int fd = memfd_create("fuzz_mpv_load", 0);
if (fd == -1) if (fd == -1)