/src/jsoncons/fuzzers/fuzz_msgpack_encoder.cpp
Line | Count | Source |
1 | | #include <jsoncons_ext/msgpack/msgpack.hpp> |
2 | | #include <jsoncons_ext/msgpack/msgpack_reader.hpp> |
3 | | |
4 | | #include <jsoncons/json.hpp> |
5 | | #include <sstream> |
6 | | |
7 | | using namespace jsoncons; |
8 | | using namespace jsoncons::msgpack; |
9 | | |
10 | | extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, std::size_t size) |
11 | 38.3k | { |
12 | 38.3k | std::string s(reinterpret_cast<const char*>(data), size); |
13 | 38.3k | std::istringstream is(s); |
14 | 38.3k | std::vector<uint8_t> s1; |
15 | 38.3k | msgpack_bytes_encoder encoder(s1); |
16 | 38.3k | msgpack_stream_reader reader(is, encoder); |
17 | | |
18 | 38.3k | std::error_code ec; |
19 | 38.3k | reader.read(ec); |
20 | | |
21 | 38.3k | return 0; |
22 | 38.3k | } |