diff options
Diffstat (limited to 'fuzzers/fuzzer_set_property.c')
-rw-r--r-- | fuzzers/fuzzer_set_property.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/fuzzers/fuzzer_set_property.c b/fuzzers/fuzzer_set_property.c index a11573825d..60edc91add 100644 --- a/fuzzers/fuzzer_set_property.c +++ b/fuzzers/fuzzer_set_property.c @@ -27,7 +27,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) case MPV_FORMAT_STRING: value_len = strnlen(data, size); if (!value_len || value_len == size) - return -1; + return 0; value_len += 1; break; case MPV_FORMAT_FLAG: @@ -46,32 +46,38 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) // at least two bytes for the name if (size < value_len + 2) - return -1; + return 0; const char *name = (const char *)data + value_len; size_t name_len = strnlen(name, size - value_len); if (!name_len || name_len != size - value_len - 1) - return -1; + return 0; mpv_handle *ctx = mpv_create(); if (!ctx) exit(1); + check_error(mpv_set_option_string(ctx, "msg-level", "all=trace")); + check_error(mpv_set_option_string(ctx, "network-timeout", "1")); + #if MPV_RUN 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_initialize(ctx)); #endif - const void *value = data; - mpv_set_property(ctx, name, MPV_FORMAT, &value); + if (MPV_FORMAT == MPV_FORMAT_STRING) { + mpv_set_property_string(ctx, name, (void *)data); + } else { + mpv_set_property(ctx, name, MPV_FORMAT, (void *)data); + } #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, "pause", "no")); + 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}; check_error(mpv_command(ctx, cmd)); |