Ada 4.1.1
Fast spec-compliant URL parser
Loading...
Searching...
No Matches
url_search_params.cc File Reference
#include <fuzzer/FuzzedDataProvider.h>
#include <memory>
#include <string>
#include "ada.cpp"
#include "ada.h"

Go to the source code of this file.

Functions

int LLVMFuzzerTestOneInput (const uint8_t *data, size_t size)

Function Documentation

◆ LLVMFuzzerTestOneInput()

int LLVMFuzzerTestOneInput ( const uint8_t * data,
size_t size )

ada::url_search_params

Serialisation idempotency.

The application/x-www-form-urlencoded serialiser must be a fixed point: parsing the serialised form of any url_search_params and serialising again must produce the same string. This invariant is mandated by the WHATWG spec and must hold for all inputs.

We test this on both the initialised params (constructed from fuzz input) and the mutated params (after append / set / remove / sort).

Round-trip via URL.

Embed the fuzz input as the query component of a real URL, extract the search params from the parsed URL's search string, and verify that the resulting params serialise idempotently. This exercises the interface between URL parsing and search-params parsing.

Definition at line 9 of file url_search_params.cc.

References ada::parse(), ada::url_search_params::size(), and ada::url_search_params::to_string().