/src/boost/libs/beast/test/fuzz/http_request.cpp
Line | Count | Source |
1 | | // |
2 | | // Copyright (c) 2024 Mikhail Khachayants |
3 | | // |
4 | | // Distributed under the Boost Software License, Version 1.0. (See accompanying |
5 | | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
6 | | // |
7 | | |
8 | | #include <boost/beast/http.hpp> |
9 | | #include <boost/beast/_experimental/test/stream.hpp> |
10 | | |
11 | | extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) |
12 | 9.05k | { |
13 | 9.05k | using namespace boost::beast; |
14 | | |
15 | 9.05k | error_code ec; |
16 | 9.05k | flat_buffer buffer; |
17 | 9.05k | net::io_context ioc; |
18 | 9.05k | test::stream stream{ioc, {reinterpret_cast<const char*>(data), size}}; |
19 | 9.05k | stream.close_remote(); |
20 | | |
21 | 9.05k | http::request_parser<http::dynamic_body> parser; |
22 | 9.05k | http::read(stream, buffer, parser, ec); |
23 | | |
24 | 9.05k | return 0; |
25 | 9.05k | } |