/src/tarantool/test/fuzz/http_parser_fuzzer.c
Line | Count | Source |
1 | | #include <stdlib.h> |
2 | | #include <stdint.h> |
3 | | #include <stddef.h> |
4 | | #include "http_parser/http_parser.h" |
5 | | |
6 | | int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) |
7 | 15.4k | { |
8 | 15.4k | struct http_parser parser; |
9 | 15.4k | const char *buf = (char *)data; |
10 | 15.4k | http_parser_create(&parser); |
11 | 15.4k | parser.hdr_name = (char *)calloc(size, sizeof(char)); |
12 | 15.4k | if (parser.hdr_name == NULL) |
13 | 0 | return 0; |
14 | 15.4k | const char *end_buf = buf + size; |
15 | 15.4k | http_parse_header_line(&parser, &buf, end_buf, size); |
16 | 15.4k | free(parser.hdr_name); |
17 | | |
18 | 15.4k | return 0; |
19 | 15.4k | } |