/src/ada-url/fuzz/ada_c.c
Line | Count | Source |
1 | | #include "ada_c.h" |
2 | | |
3 | | #include <stdbool.h> |
4 | | #include <stdio.h> |
5 | | #include <stdlib.h> |
6 | | #include <string.h> |
7 | | |
8 | 8.55k | int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { |
9 | | /** |
10 | | * ada_c |
11 | | */ |
12 | 8.55k | ada_url out = ada_parse((char*)data, size); |
13 | 8.55k | bool is_valid = ada_is_valid(out); |
14 | | |
15 | 8.55k | if (is_valid) { |
16 | 6.56k | ada_set_href(out, (char*)data, size); |
17 | 6.56k | ada_set_host(out, (char*)data, size); |
18 | 6.56k | ada_set_hostname(out, (char*)data, size); |
19 | 6.56k | ada_set_protocol(out, (char*)data, size); |
20 | 6.56k | ada_set_username(out, (char*)data, size); |
21 | 6.56k | ada_set_password(out, (char*)data, size); |
22 | 6.56k | ada_set_port(out, (char*)data, size); |
23 | 6.56k | ada_set_pathname(out, (char*)data, size); |
24 | 6.56k | ada_set_search(out, (char*)data, size); |
25 | 6.56k | ada_set_hash(out, (char*)data, size); |
26 | | |
27 | 6.56k | ada_get_hash(out); |
28 | 6.56k | ada_get_host(out); |
29 | 6.56k | ada_get_host_type(out); |
30 | 6.56k | ada_get_hostname(out); |
31 | 6.56k | ada_get_href(out); |
32 | 6.56k | ada_owned_string out_get_origin = ada_get_origin(out); |
33 | 6.56k | ada_get_pathname(out); |
34 | 6.56k | ada_get_username(out); |
35 | 6.56k | ada_get_password(out); |
36 | 6.56k | ada_get_protocol(out); |
37 | 6.56k | ada_get_port(out); |
38 | 6.56k | ada_get_search(out); |
39 | 6.56k | ada_get_scheme_type(out); |
40 | | |
41 | 6.56k | ada_has_credentials(out); |
42 | 6.56k | ada_has_empty_hostname(out); |
43 | 6.56k | ada_has_hostname(out); |
44 | 6.56k | ada_has_non_empty_username(out); |
45 | 6.56k | ada_has_non_empty_password(out); |
46 | 6.56k | ada_has_port(out); |
47 | 6.56k | ada_has_password(out); |
48 | 6.56k | ada_has_hash(out); |
49 | 6.56k | ada_has_search(out); |
50 | | |
51 | 6.56k | ada_get_components(out); |
52 | | |
53 | 6.56k | ada_clear_port(out); |
54 | 6.56k | ada_clear_hash(out); |
55 | 6.56k | ada_clear_search(out); |
56 | | |
57 | 6.56k | ada_free_owned_string(out_get_origin); |
58 | 6.56k | } |
59 | | |
60 | 8.55k | bool can_parse_result = ada_can_parse((char*)data, size); |
61 | | |
62 | 8.55k | ada_free(out); |
63 | | |
64 | 8.55k | return 0; |
65 | 8.55k | } |