mirror of
https://github.com/oatpp/oatpp.git
synced 2025-01-30 16:59:30 +08:00
Merge pull request #427 from DavidKorczynski/master
Migrating fuzzers from oss-fuzz.
This commit is contained in:
commit
501b7cc00d
27
fuzzers/oatpp/parser/json/mapping/ObjectMapper.cpp
Normal file
27
fuzzers/oatpp/parser/json/mapping/ObjectMapper.cpp
Normal 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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user