/src/jsoncons/fuzzers/fuzz_bson.cpp
Line | Count | Source |
1 | | #include <jsoncons_ext/bson/bson.hpp> |
2 | | #include <jsoncons/json.hpp> |
3 | | |
4 | | #include <sstream> |
5 | | #include <vector> |
6 | | #include <utility> |
7 | | #include <ctime> |
8 | | #include <limits> |
9 | | |
10 | | using namespace jsoncons; |
11 | | |
12 | | extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, std::size_t size) |
13 | 4.29k | { |
14 | 4.29k | std::string input(reinterpret_cast<const char*>(data), size); |
15 | 4.29k | std::istringstream is(input); |
16 | 4.29k | try { |
17 | 4.29k | json j2 = bson::decode_bson<json>(is); |
18 | 4.29k | } |
19 | 4.29k | catch(const jsoncons::ser_error&) {} |
20 | | |
21 | 4.29k | return 0; |
22 | 4.29k | } |