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