nekoray_Mahdi-zarei/3rdparty/simple-protobuf/test/fuzzer/spb-json-fuzzer.cpp
parhelia512 daa6c93900
refactor: migrate from protobuf to simple-protobuf (#520)
* refactor: migrate from protobuf to simple-protobuf

* update go.mod

* fix server

* Update gRPC.cpp

* Update gRPC.cpp
2025-07-12 15:17:05 -07:00

28 lines
672 B
C++

#include <cstdint>
#include <cstdlib>
#include <map.pb.h>
#include <person.pb.h>
#include <proto3.pb.h>
#include <scalar.pb.h>
#include <string_view>
template < typename T >
static void json_decode( const uint8_t * Data, size_t Size )
{
try
{
auto result = spb::json::deserialize< T >( { reinterpret_cast< const char * >( Data ), Size } );
}
catch( ... )
{
}
}
extern "C" int LLVMFuzzerTestOneInput( const uint8_t * Data, size_t Size )
{
json_decode< PhoneBook::Person >( Data, Size );
json_decode< proto3_unittest::TestAllTypes >( Data, Size );
json_decode< proto3_unittest::TestEmptyMessage >( Data, Size );
return 0;
}