Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions fuzzers/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

#include <mpv/client.h>

#define MAX_FUZZ_SIZE (100 << 10) // 100 KiB

int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);

#define MPV_STRINGIFY_(X) #X
Expand Down
3 changes: 3 additions & 0 deletions fuzzers/fuzzer_json.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@

int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
if (size > MAX_FUZZ_SIZE)
return 0;

void *tmp = talloc_new(NULL);
char *s = talloc_array_ptrtype(tmp, s, size + 1);
memcpy(s, data, size);
Expand Down
3 changes: 3 additions & 0 deletions fuzzers/fuzzer_load.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@

int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
if (size > MAX_FUZZ_SIZE)
return 0;

#ifdef MPV_LOAD_CONFIG_FILE
// config file size limit, see m_config_parse_config_file()
if (size > 1000000000)
Expand Down
3 changes: 3 additions & 0 deletions fuzzers/fuzzer_loadfile_direct.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@

int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
if (size > MAX_FUZZ_SIZE)
return 0;

if (size <= 1 || data[size - 1] != '\0')
return 0;

Expand Down
3 changes: 3 additions & 0 deletions fuzzers/fuzzer_set_property.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@

int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
if (size > MAX_FUZZ_SIZE)
return 0;

size_t value_len;
switch (MPV_FORMAT)
{
Expand Down