File: fuzz_bson_encoder.cpp

package info (click to toggle)
jsoncons 1.5.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 18,300 kB
  • sloc: cpp: 143,266; sh: 34; makefile: 8
file content (21 lines) | stat: -rw-r--r-- 534 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <jsoncons_ext/bson/bson.hpp>
#include <jsoncons_ext/bson/bson_reader.hpp>
#include <jsoncons/json.hpp>
#include <sstream>

using namespace jsoncons;
using namespace jsoncons::bson;

extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, std::size_t size)
{
    std::string s(reinterpret_cast<const char*>(data), size);
    std::istringstream is(s);
    std::vector<uint8_t> s1;
    bson_bytes_encoder encoder(s1);
    bson_stream_reader reader(is, encoder);

    std::error_code ec;
    reader.read(ec);

    return 0;
}