MCPcopy Create free account
hub / github.com/Kitware/CMake / LLVMFuzzerTestOneInput

Function LLVMFuzzerTestOneInput

Tests/Fuzzing/cmJSONParserFuzzer.cxx:71–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size)
72{
73 if (size == 0 || size > kMaxInputSize) {
74 return 0;
75 }
76
77 std::string input(reinterpret_cast<char const*>(data), size);
78
79 Json::Value root;
80 Json::CharReaderBuilder builder;
81 std::string errors;
82
83 std::istringstream stream(input);
84
85 // Try parsing with default settings
86 bool success = Json::parseFromStream(builder, stream, &root, &errors);
87
88 if (success) {
89 // Traverse the parsed structure
90 TraverseValue(root);
91 }
92
93 // Also try with strict mode
94 builder["strictRoot"] = true;
95 builder["allowComments"] = false;
96 builder["allowTrailingCommas"] = false;
97
98 stream.clear();
99 stream.str(input);
100
101 success = Json::parseFromStream(builder, stream, &root, &errors);
102 if (success) {
103 TraverseValue(root);
104 }
105
106 return 0;
107}

Callers

nothing calls this directly

Calls 4

parseFromStreamFunction · 0.85
TraverseValueFunction · 0.85
strMethod · 0.80
clearMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…