diff --git a/fuzz/idna.cc b/fuzz/idna.cc index 31ad94be4..ac4f0cda2 100644 --- a/fuzz/idna.cc +++ b/fuzz/idna.cc @@ -9,7 +9,6 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { FuzzedDataProvider fdp(data, size); std::string source = fdp.ConsumeRandomLengthString(256); - std::string base_source = fdp.ConsumeRandomLengthString(256); /** * ada::idna diff --git a/fuzz/url_pattern.cc b/fuzz/url_pattern.cc index cbc1c8c06..4807cc336 100644 --- a/fuzz/url_pattern.cc +++ b/fuzz/url_pattern.cc @@ -8,37 +8,36 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { FuzzedDataProvider fdp(data, size); - std::string source = fdp.ConsumeRandomLengthString(256); - std::string base_source = fdp.ConsumeRandomLengthString(256); + std::string source = fdp.ConsumeRandomLengthString(100); // Without base or options - auto result = ada::parse_url_pattern(source, nullptr, nullptr); + auto result = ada::parse_url_pattern(std::string_view(source), nullptr, nullptr); (void)result; - // Testing with base_url - std::string_view base_source_view(base_source.data(), base_source.length()); - auto result_with_base = - ada::parse_url_pattern(source, &base_source_view, nullptr); - (void)result_with_base; - - // Testing with base_url and options - ada::url_pattern_options options{.ignore_case = true}; - auto result_with_base_and_options = - ada::parse_url_pattern(source, &base_source_view, &options); - (void)result_with_base_and_options; - - // Testing with url_pattern_init and base url. - ada::url_pattern_init init{.protocol = source, - .username = source, - .password = source, - .hostname = source, - .port = source, - .pathname = source, - .search = source, - .hash = source}; - auto result_with_init = - ada::parse_url_pattern(init, &base_source_view, nullptr); - (void)result_with_init; +// // Testing with base_url +// std::string_view base_source_view(base_source.data(), base_source.length()); +// auto result_with_base = +// ada::parse_url_pattern(source, &base_source_view, nullptr); +// (void)result_with_base; +// +// // Testing with base_url and options +// ada::url_pattern_options options{.ignore_case = true}; +// auto result_with_base_and_options = +// ada::parse_url_pattern(source, &base_source_view, &options); +// (void)result_with_base_and_options; +// +// // Testing with url_pattern_init and base url. +// ada::url_pattern_init init{.protocol = source, +// .username = source, +// .password = source, +// .hostname = source, +// .port = source, +// .pathname = source, +// .search = source, +// .hash = source}; +// auto result_with_init = +// ada::parse_url_pattern(init, &base_source_view, nullptr); +// (void)result_with_init; return 0; } diff --git a/fuzz/url_pattern.options b/fuzz/url_pattern.options new file mode 100644 index 000000000..c1025fc28 --- /dev/null +++ b/fuzz/url_pattern.options @@ -0,0 +1,4 @@ +[libfuzzer] +dict = url.dict +max_len = 512 +rss_limit_mb = 3000