mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-27 11:06:50 +01:00
test: move fuzzing tests from google/oss-fuzz repository (#4719)
This commit is contained in:
26
JSON/fuzzing/JsonParse.cpp
Normal file
26
JSON/fuzzing/JsonParse.cpp
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user