/src/http-parser/fuzzers/fuzz_parser.c
Line | Count | Source |
1 | | #include <stdint.h> |
2 | | #include <stdlib.h> |
3 | | #include <string.h> |
4 | | #include "http_parser.h" |
5 | | |
6 | | int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) |
7 | 5.28k | { |
8 | 5.28k | static const http_parser_settings settings_null = { |
9 | 5.28k | .on_message_begin = 0 |
10 | 5.28k | , .on_header_field = 0 |
11 | 5.28k | ,.on_header_value = 0 |
12 | 5.28k | ,.on_url = 0 |
13 | 5.28k | ,.on_status = 0 |
14 | 5.28k | ,.on_body = 0 |
15 | 5.28k | ,.on_headers_complete = 0 |
16 | 5.28k | ,.on_message_complete = 0 |
17 | 5.28k | ,.on_chunk_header = 0 |
18 | 5.28k | ,.on_chunk_complete = 0 |
19 | 5.28k | }; |
20 | | |
21 | 5.28k | http_parser parser; |
22 | 5.28k | http_parser_init(&parser, HTTP_BOTH); |
23 | 5.28k | http_parser_execute(&parser, &settings_null, (char*)data, size); |
24 | | |
25 | 5.28k | return 0; |
26 | 5.28k | } |