File: fuzz_json_encoder.cpp

package info (click to toggle)
jsoncons 1.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 17,932 kB
  • sloc: cpp: 141,335; sh: 33; makefile: 5
file content (18 lines) | stat: -rw-r--r-- 428 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <jsoncons/json_parser.hpp>
#include <jsoncons/json.hpp>

using namespace jsoncons;

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::string s2;
    json_string_encoder visitor(s2);
    json_stream_reader reader(is, visitor);
    std::error_code ec;
    reader.read(ec);

    return 0;
}