test: move fuzzing tests from google/oss-fuzz repository (#4719)

This commit is contained in:
tyler92
2024-10-10 14:30:10 +03:00
committed by GitHub
parent c038b52f36
commit aa0faed54f
40 changed files with 857 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
#include "Poco/JSON/Parser.h"
using namespace Poco;
using namespace Poco::JSON;
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
std::string json(reinterpret_cast<const char*>(data), size);
Parser parser;
Dynamic::Var result;
try
{
result = parser.parse(json);
}
catch (Exception& e)
{
return 0;
}
catch (const std::exception& e)
{
return 0;
}
return 0;
}