main.cpp 767 B

123456789101112131415161718192021222324252627282930
  1. #include <library/cpp/json/json_reader.h>
  2. #include <util/random/random.h>
  3. #include <util/stream/str.h>
  4. extern "C" int LLVMFuzzerTestOneInput(const ui8* data, size_t size) {
  5. const auto json = TString((const char*)data, size);
  6. try {
  7. NJson::TJsonValue value;
  8. NJson::ReadJsonFastTree(json, &value, true);
  9. } catch (...) {
  10. //Cout << json << " -> " << CurrentExceptionMessage() << Endl;
  11. }
  12. try {
  13. NJson::TJsonCallbacks cb;
  14. NJson::ReadJsonFast(json, &cb);
  15. } catch (...) {
  16. //Cout << json << " -> " << CurrentExceptionMessage() << Endl;
  17. }
  18. try {
  19. NJson::ValidateJson(json);
  20. } catch (...) {
  21. //Cout << json << " -> " << CurrentExceptionMessage() << Endl;
  22. }
  23. return 0;
  24. }