|
Ada 4.1.1
Fast spec-compliant URL parser
|
#include <fuzzer/FuzzedDataProvider.h>#include <cassert>#include <cstdio>#include <memory>#include <string>#include "ada.cpp"#include "ada.h"Go to the source code of this file.
Functions | |
| bool | is_valid_utf8_string (const char *buf, size_t len) |
| static void | exercise_url_predicates (const ada::url &u) |
| static void | exercise_aggregator_predicates (const ada::url_aggregator &u) |
| static std::string | make_simple_absolute_candidate (FuzzedDataProvider &fdp) |
| static void | check_href_size_invariant (const ada::url &u) |
| static void | check_href_size_invariant (const ada::url_aggregator &u) |
| int | LLVMFuzzerTestOneInput (const uint8_t *data, size_t size) |
|
static |
Definition at line 215 of file parse.cc.
References ada::url::get_href(), and ada::url::get_href_size().
Referenced by LLVMFuzzerTestOneInput().
|
static |
Definition at line 223 of file parse.cc.
References ada::url_aggregator::get_href(), and ada::url_aggregator::get_href_size().
|
static |
Definition at line 122 of file parse.cc.
References ada::url_aggregator::get_components(), ada::url_aggregator::get_hash(), ada::url_aggregator::get_host(), ada::url_aggregator::get_hostname(), ada::url_aggregator::get_href(), ada::url_aggregator::get_origin(), ada::url_aggregator::get_password(), ada::url_aggregator::get_pathname(), ada::url_aggregator::get_pathname_length(), ada::url_aggregator::get_port(), ada::url_aggregator::get_protocol(), ada::url_aggregator::get_search(), ada::url_aggregator::get_username(), ada::url_aggregator::has_credentials(), ada::url_aggregator::has_empty_hostname(), ada::url_aggregator::has_hash(), ada::url_aggregator::has_hostname(), ada::url_aggregator::has_non_empty_password(), ada::url_aggregator::has_non_empty_username(), ada::url_aggregator::has_password(), ada::url_aggregator::has_port(), ada::url_aggregator::has_search(), ada::url_aggregator::has_valid_domain(), ada::url_aggregator::to_diagram(), ada::url_aggregator::to_string(), and ada::url_aggregator::validate().
Referenced by LLVMFuzzerTestOneInput().
|
static |
Definition at line 96 of file parse.cc.
References ada::url::get_components(), ada::url::get_hash(), ada::url::get_host(), ada::url::get_hostname(), ada::url::get_href(), ada::url::get_origin(), ada::url::get_password(), ada::url::get_pathname(), ada::url::get_pathname_length(), ada::url::get_port(), ada::url::get_protocol(), ada::url::get_search(), ada::url::get_username(), ada::url::has_credentials(), ada::url::has_empty_hostname(), ada::url::has_hash(), ada::url::has_hostname(), ada::url::has_port(), ada::url::has_search(), ada::url::has_valid_domain(), and ada::url::to_string().
Referenced by LLVMFuzzerTestOneInput().
| bool is_valid_utf8_string | ( | const char * | buf, |
| size_t | len ) |
Definition at line 11 of file parse.cc.
Referenced by LLVMFuzzerTestOneInput().
| int LLVMFuzzerTestOneInput | ( | const uint8_t * | data, |
| size_t | size ) |
Test copy and move semantics
ada::parse<ada::url_aggregator>
Relative URL parsing with base (tests the base URL resolution code path)
Chained relative URL resolution: parse source against base, then use the result as the base for a second parse. Exercises multi-level inheritance.
Known-good base URL with fuzzed relative input. Using a fixed valid base lets the fuzzer focus entropy entirely on the relative-input code paths (path resolution, query/fragment inheritance, scheme-relative URLs, etc.)
Node.js specific
Others
Sequential setter interactions with FDP-controlled ordering.
The existing code calls every setter with the same source value in a fixed order. Here we let the fuzzer choose an arbitrary sequence of setter/value pairs, checking that url and url_aggregator stay in sync after every step. This exercises setter-interaction state bugs that fixed-order testing would miss.
Re-parse idempotency.
If parse(source) succeeds, then parse(href) must also succeed and produce the same href. Serialization and parsing must be consistent: a normalized URL is always its own fixed point.
URL search params round-trip via URL integration.
Construct a URL whose query is the fuzz source, extract the search component as a url_search_params, mutate it, serialise it back, and set it on the URL. Exercises the interaction between URL objects and url_search_params and verifies that the combined pipeline doesn't crash.
Also verifies the url_search_params serialisation idempotency property: url_search_params(sp.to_string()).to_string() == sp.to_string()
Definition at line 233 of file parse.cc.
References ada::url_search_params::append(), check_href_size_invariant(), exercise_aggregator_predicates(), exercise_url_predicates(), ada::url::get_href(), ada::url_aggregator::get_href(), ada::href_from_file(), is_valid_utf8_string(), make_simple_absolute_candidate(), ada::parse(), and ada::url_search_params::to_string().