aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/json/fuzzy_test/main.cpp
blob: 29a53aac1427b772d1ea7f9cbe9f9f042c84344f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <library/cpp/json/json_reader.h>

#include <util/random/random.h>
#include <util/stream/str.h>

extern "C" int LLVMFuzzerTestOneInput(const ui8* data, size_t size) {
    const auto json = TString((const char*)data, size);

    try {
        NJson::TJsonValue value;
        NJson::ReadJsonFastTree(json, &value, true);
    } catch (...) {
        //Cout << json << " -> " << CurrentExceptionMessage() << Endl;
    }

    try {
        NJson::TJsonCallbacks cb;
        NJson::ReadJsonFast(json, &cb);
    } catch (...) {
        //Cout << json << " -> " << CurrentExceptionMessage() << Endl;
    }

    try {
        NJson::ValidateJson(json);
    } catch (...) {
        //Cout << json << " -> " << CurrentExceptionMessage() << Endl;
    }

    return 0;
}