| 69 | } |
| 70 | |
| 71 | extern "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 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…