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

Go to the source code of this file.

Functions

template<size_t N>
static const char * pick (FuzzedDataProvider &fdp, const char *const (&arr)[N])
static std::string make_candidate (FuzzedDataProvider &fdp)
static void check_href_size (const ada::url &u, std::string_view input)
static void check_href_size (const ada::url_aggregator &u, std::string_view input)
template<class Result>
static void check_reparse_idempotent (const Result &parsed, std::string_view input)
static void check_components_agree (const ada::url &u, const ada::url_aggregator &a, std::string_view input)
static void fuzz_one_input (std::string_view input)
int LLVMFuzzerTestOneInput (const uint8_t *data, size_t size)

Variables

static constexpr const char * kSchemes []
static constexpr const char * kHosts []
static constexpr const char * kPaths []
static constexpr const char * kQueries []
static constexpr const char * kFrags []

Function Documentation

◆ check_components_agree()

◆ check_href_size() [1/2]

void check_href_size ( const ada::url & u,
std::string_view input )
static

Definition at line 94 of file simple_absolute.cc.

References ada::url::get_href(), and ada::url::get_href_size().

Referenced by fuzz_one_input().

◆ check_href_size() [2/2]

void check_href_size ( const ada::url_aggregator & u,
std::string_view input )
static

◆ check_reparse_idempotent()

template<class Result>
void check_reparse_idempotent ( const Result & parsed,
std::string_view input )
static

Definition at line 122 of file simple_absolute.cc.

References ada::parse().

Referenced by fuzz_one_input().

◆ fuzz_one_input()

void fuzz_one_input ( std::string_view input)
static

◆ LLVMFuzzerTestOneInput()

int LLVMFuzzerTestOneInput ( const uint8_t * data,
size_t size )

Definition at line 212 of file simple_absolute.cc.

References fuzz_one_input(), and make_candidate().

◆ make_candidate()

std::string make_candidate ( FuzzedDataProvider & fdp)
static

Definition at line 74 of file simple_absolute.cc.

References kFrags, kHosts, kPaths, kQueries, kSchemes, and pick().

Referenced by LLVMFuzzerTestOneInput().

◆ pick()

template<size_t N>
const char * pick ( FuzzedDataProvider & fdp,
const char *const (&) arr[N] )
static

Definition at line 70 of file simple_absolute.cc.

References N.

Referenced by make_candidate(), and TEST_F().

Variable Documentation

◆ kFrags

const char* kFrags[]
staticconstexpr
Initial value:
= {
"", "#", "#frag", "#x%20y", "#/",
}

Definition at line 65 of file simple_absolute.cc.

Referenced by make_candidate(), and make_simple_absolute_candidate().

◆ kHosts

const char* kHosts[]
staticconstexpr
Initial value:
= {
"example.com",
"www.example.com",
"WWW.Example.COM",
"a",
"a.b.c",
"maps.google.com",
"192.168.0.1",
"0x7f.1",
"127.1",
"0",
"3232235777",
"xn--nxasmq6b.com",
"xn--a",
"XN--A",
"user@example.com",
"user:pass@example.com",
"example.com:8080",
"example.com:0",
"example.com:65535",
"",
}

Definition at line 14 of file simple_absolute.cc.

Referenced by make_candidate(), make_simple_absolute_candidate(), and make_url_candidate().

◆ kPaths

const char* kPaths[]
staticconstexpr
Initial value:
= {
"",
"/",
"/path",
"/path/file.js",
"/a/./b/../c",
"/foo/%2e",
"/foo/%2e%2e",
"/foo/%2E%2E/bar",
"/path with space",
"/path\twith\ttab",
"\\path",
"/continue=https%3A%2F%2Fexample.com%2F",
"/imghp",
"/./",
"/../",
"/%2e%2e%2f",
}

Definition at line 37 of file simple_absolute.cc.

Referenced by make_candidate(), and make_simple_absolute_candidate().

◆ kQueries

const char* kQueries[]
staticconstexpr
Initial value:
= {
"",
"?",
"?q=1",
"?hl=en&tab=wi",
"?continue=https%3A%2F%2Fexample.com%2F",
"?a=1&b=2&c=3",
}

Definition at line 56 of file simple_absolute.cc.

Referenced by make_candidate(), and make_simple_absolute_candidate().

◆ kSchemes

const char* kSchemes[]
staticconstexpr
Initial value:
= {
"http://", "https://", "HTTP://", "Https://",
"http:", "https:", "htTP://", "HTTPS://"}

Definition at line 10 of file simple_absolute.cc.

Referenced by make_candidate(), make_simple_absolute_candidate(), and make_url_candidate().