11 const uint8_t *data =
reinterpret_cast<const uint8_t *
>(buf);
13 uint32_t code_point = 0;
15 uint64_t next_pos = pos + 16;
16 if (next_pos <= len) {
19 std::memcpy(&v1, data + pos,
sizeof(uint64_t));
21 std::memcpy(&v2, data + pos +
sizeof(uint64_t),
sizeof(uint64_t));
23 if ((v & 0x8080808080808080) == 0) {
28 unsigned char byte = data[pos];
29 while (
byte < 0b10000000) {
36 if ((
byte & 0b11100000) == 0b11000000) {
41 if ((data[pos + 1] & 0b11000000) != 0b10000000) {
44 code_point = (
byte & 0b00011111) << 6 | (data[pos + 1] & 0b00111111);
45 if ((code_point < 0x80) || (0x7ff < code_point)) {
48 }
else if ((
byte & 0b11110000) == 0b11100000) {
53 if ((data[pos + 1] & 0b11000000) != 0b10000000) {
56 if ((data[pos + 2] & 0b11000000) != 0b10000000) {
59 code_point = (
byte & 0b00001111) << 12 |
60 (data[pos + 1] & 0b00111111) << 6 |
61 (data[pos + 2] & 0b00111111);
62 if ((code_point < 0x800) || (0xffff < code_point) ||
63 (0xd7ff < code_point && code_point < 0xe000)) {
66 }
else if ((
byte & 0b11111000) == 0b11110000) {
71 if ((data[pos + 1] & 0b11000000) != 0b10000000) {
74 if ((data[pos + 2] & 0b11000000) != 0b10000000) {
77 if ((data[pos + 3] & 0b11000000) != 0b10000000) {
81 (
byte & 0b00000111) << 18 | (data[pos + 1] & 0b00111111) << 12 |
82 (data[pos + 2] & 0b00111111) << 6 | (data[pos + 3] & 0b00111111);
83 if (code_point <= 0xffff || 0x10ffff < code_point) {
95 FuzzedDataProvider fdp(data, size);
96 std::string source = fdp.ConsumeRandomLengthString(256);
100 volatile size_t length = 0;
106 if (parse_url.has_value() ^ parse_url_aggregator.has_value()) {
107 printf(
"Source used to parse: %s", source.c_str());
113 length += parse_url->get_href().size();
114 length += parse_url->get_origin().size();
117 if (parse_url_aggregator) {
118 length += parse_url_aggregator->get_href().size();
119 length += parse_url_aggregator->get_origin().size();
121 volatile bool is_parse_url_aggregator_output_valid =
false;
122 is_parse_url_aggregator_output_valid = parse_url_aggregator->validate();
124 assert(parse_url->get_protocol() == parse_url_aggregator->get_protocol());
125 assert(parse_url->get_href() == parse_url_aggregator->get_href());
127 parse_url->set_href(source);
128 parse_url_aggregator->set_href(source);
129 assert(parse_url->get_href() == parse_url_aggregator->get_href());
138 out_url->set_protocol(source);
139 out_url->set_username(source);
140 out_url->set_password(source);
141 out_url->set_hostname(source);
142 out_url->set_host(source);
143 out_url->set_pathname(source);
144 out_url->set_search(source);
145 out_url->set_hash(source);
146 out_url->set_port(source);
149 length += out_url->get_protocol().size();
150 length += out_url->get_username().size();
151 length += out_url->get_password().size();
152 length += out_url->get_hostname().size();
153 length += out_url->get_host().size();
154 length += out_url->get_pathname().size();
155 length += out_url->get_search().size();
156 length += out_url->get_hash().size();
157 length += out_url->get_origin().size();
158 length += out_url->get_port().size();
160 length += out_url->to_string().size();
166 auto out_aggregator =
169 if (out_aggregator) {
170 out_aggregator->set_protocol(source);
171 out_aggregator->set_username(source);
172 out_aggregator->set_password(source);
173 out_aggregator->set_hostname(source);
174 out_aggregator->set_host(source);
175 out_aggregator->set_pathname(source);
176 out_aggregator->set_search(source);
177 out_aggregator->set_hash(source);
178 out_aggregator->set_port(source);
181 length += out_aggregator->get_protocol().size();
182 length += out_aggregator->get_username().size();
183 length += out_aggregator->get_password().size();
184 length += out_aggregator->get_hostname().size();
185 length += out_aggregator->get_host().size();
186 length += out_aggregator->get_pathname().size();
187 length += out_aggregator->get_search().size();
188 length += out_aggregator->get_hash().size();
189 length += out_aggregator->get_origin().size();
190 length += out_aggregator->get_port().size();
192 length += out_aggregator->to_string().size();
194 volatile bool is_output_valid =
false;
195 is_output_valid = out_aggregator->validate();
198 printf(
"diagram %s\n", out_aggregator->to_diagram().c_str());
201 out_aggregator->clear_port();
202 out_aggregator->clear_search();
203 out_aggregator->clear_hash();
214 bool is_valid = ada::checkers::verify_dns_length(source);
218 printf(
"dns length is valid\n");
222 printf(
"length of url is %zu\n", length);