Merge pull request #427 from DavidKorczynski/master

Migrating fuzzers from oss-fuzz.
This commit is contained in:
Leonid Stryzhevskyi 2021-05-07 19:58:02 +03:00 committed by GitHub
commit 501b7cc00d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -0,0 +1,27 @@
#include "oatpp/parser/json/mapping/ObjectMapper.hpp"
#include "oatpp/core/macro/codegen.hpp"
typedef oatpp::parser::Caret ParsingCaret;
typedef oatpp::parser::json::mapping::Serializer Serializer;
typedef oatpp::parser::json::mapping::Deserializer Deserializer;
#include OATPP_CODEGEN_BEGIN(DTO)
class EmptyDto : public oatpp::DTO {
DTO_INIT(EmptyDto, DTO)
};
class Test1 : public oatpp::DTO {
DTO_INIT(Test1, DTO)
DTO_FIELD(String, strF);
};
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
oatpp::String input(reinterpret_cast<const char*>(data), size, true);
oatpp::parser::json::mapping::ObjectMapper mapper;
try {
mapper.readFromString<oatpp::Object<Test1>>(input);
} catch(...) {}
return 0;
}