Skip to content

Commit 6780e4d

Browse files
author
pfeatherstone
committed
print error messages if any
1 parent 763b699 commit 6780e4d

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

examples/fuzz/request_parser.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
1111
parser.parse(req, buf, ec);
1212
bool is_keep_alive = req.keep_alive();
1313
bool is_websocket_req = req.is_websocket_req();
14+
std::string ec_msg = ec ? ec.message() : "";
1415
buf.clear();
1516
ec = {};
1617
http::serialize_header(req, buf, ec);
1718
req.clear();
19+
ec_msg = ec ? ec.message() : "";
1820
return 0;
1921
}

examples/fuzz/response_parser.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
1010
http::parser_response parser;
1111
parser.parse(resp, buf, ec);
1212
buf.clear();
13+
std::string ec_msg = ec ? ec.message() : "";
1314
ec = {};
1415
http::serialize_header(resp, buf, ec);
1516
resp.keep_alive(true);
1617
bool is_websocket = resp.is_websocket_response();
1718
resp.clear();
19+
ec_msg = ec ? ec.message() : "";
1820
return 0;
1921
}

examples/fuzz/websocket_parser.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
1111
http::parser_request parser;
1212
parser.parse(req, buf, ec);
1313
bool is_websocket_req = req.is_websocket_req();
14+
std::string ec_msg = ec ? ec.message() : "";
1415

1516
std::vector<char> msg;
1617
http::dynamic_buffer view(msg);
@@ -21,6 +22,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
2122
const auto current_size = view.size();
2223
const auto current_data = view.data();
2324
const auto current_buf = view.buffer();
25+
ec_msg = ec ? ec.message() : "";
26+
2427
view.resize(10);
2528
view.clear();
2629
msg.assign(data, data+size);

0 commit comments

Comments
 (0)