MCPcopy Create free account
hub / github.com/apache/trafficserver / LLVMFuzzerTestOneInput

Function LLVMFuzzerTestOneInput

tests/fuzzing/fuzz_http.cc:33–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31extern int cmd_disable_pfreelist;
32
33extern "C" int
34LLVMFuzzerTestOneInput(const uint8_t *input_data, size_t size_data)
35{
36 if (size_data < kMinInputLength || size_data > kMaxInputLength) {
37 return 0;
38 }
39
40 std::string input(reinterpret_cast<const char *>(input_data), size_data);
41 char const *start = input.c_str();
42 char const *end = input.c_str() + input.size();
43
44 cmd_disable_pfreelist = true;
45 DiagsPtr::set(new Diags("fuzzing", "", "", nullptr));
46
47 http_init();
48
49 HTTPParser parser;
50 HTTPHdr req_hdr, rsp_hdr, req_hdr_2, rsp_hdr_2, req_hdr_3, rsp_hdr_3;
51
52 req_hdr.create(HTTP_TYPE_REQUEST);
53 rsp_hdr.create(HTTP_TYPE_RESPONSE);
54 req_hdr_2.create(HTTP_TYPE_REQUEST, HTTP_2_0);
55 rsp_hdr_2.create(HTTP_TYPE_RESPONSE, HTTP_2_0);
56 req_hdr_3.create(HTTP_TYPE_REQUEST, HTTP_3_0);
57 rsp_hdr_3.create(HTTP_TYPE_RESPONSE, HTTP_3_0);
58
59 {
60 http_parser_init(&parser);
61 ParseResult result = req_hdr.parse_req(&parser, &start, end, true);
62 http_parser_clear(&parser);
63 }
64 {
65 http_parser_init(&parser);
66 ParseResult result = rsp_hdr.parse_resp(&parser, &start, end, true);
67 http_parser_clear(&parser);
68 }
69 {
70 http_parser_init(&parser);
71 ParseResult result = req_hdr_2.parse_req(&parser, &start, end, true);
72 http_parser_clear(&parser);
73 }
74 {
75 http_parser_init(&parser);
76 ParseResult result = rsp_hdr_2.parse_resp(&parser, &start, end, true);
77 http_parser_clear(&parser);
78 }
79 {
80 http_parser_init(&parser);
81 ParseResult result = req_hdr_3.parse_req(&parser, &start, end, true);
82 http_parser_clear(&parser);
83 }
84 {
85 http_parser_init(&parser);
86 ParseResult result = rsp_hdr_3.parse_resp(&parser, &start, end, true);
87 http_parser_clear(&parser);
88 }
89
90 req_hdr.destroy();

Callers

nothing calls this directly

Calls 11

setFunction · 0.85
http_initFunction · 0.85
http_parser_initFunction · 0.85
http_parser_clearFunction · 0.85
diagsFunction · 0.85
c_strMethod · 0.45
sizeMethod · 0.45
createMethod · 0.45
parse_reqMethod · 0.45
parse_respMethod · 0.45
destroyMethod · 0.45

Tested by

no test coverage detected