diff options
author | robot-contrib <robot-contrib@yandex-team.com> | 2022-10-28 07:50:04 +0300 |
---|---|---|
committer | robot-contrib <robot-contrib@yandex-team.com> | 2022-10-28 07:50:04 +0300 |
commit | 9b6cded108571fe7983a855c40c7545bf4b7aad2 (patch) | |
tree | bf5fe3a440a47d1a49f05eae25af134c0c831408 /contrib/libs/protobuf-mutator/src | |
parent | e86badd466683de764e9ca22bc185566b43b82e6 (diff) | |
download | ydb-9b6cded108571fe7983a855c40c7545bf4b7aad2.tar.gz |
Update contrib/restricted/aws/aws-c-common to 0.8.3
Diffstat (limited to 'contrib/libs/protobuf-mutator/src')
-rw-r--r-- | contrib/libs/protobuf-mutator/src/binary_format.cc | 3 | ||||
-rw-r--r-- | contrib/libs/protobuf-mutator/src/libfuzzer/libfuzzer_macro.h | 30 |
2 files changed, 24 insertions, 9 deletions
diff --git a/contrib/libs/protobuf-mutator/src/binary_format.cc b/contrib/libs/protobuf-mutator/src/binary_format.cc index 9bf3c3494a..33ec77dba3 100644 --- a/contrib/libs/protobuf-mutator/src/binary_format.cc +++ b/contrib/libs/protobuf-mutator/src/binary_format.cc @@ -19,7 +19,8 @@ namespace protobuf_mutator { using protobuf::Message; bool ParseBinaryMessage(const uint8_t* data, size_t size, Message* output) { - return ParseBinaryMessage({reinterpret_cast<const char*>(data), size}, output); + return ParseBinaryMessage({reinterpret_cast<const char*>(data), size}, + output); } bool ParseBinaryMessage(const TProtoStringType& data, protobuf::Message* output) { diff --git a/contrib/libs/protobuf-mutator/src/libfuzzer/libfuzzer_macro.h b/contrib/libs/protobuf-mutator/src/libfuzzer/libfuzzer_macro.h index 1a1fe0a297..b5cb201810 100644 --- a/contrib/libs/protobuf-mutator/src/libfuzzer/libfuzzer_macro.h +++ b/contrib/libs/protobuf-mutator/src/libfuzzer/libfuzzer_macro.h @@ -82,14 +82,15 @@ using PostProcessorRegistration = \ protobuf_mutator::libfuzzer::PostProcessorRegistration<Proto>; -#define DEFINE_PROTO_FUZZER_IMPL(use_binary, arg) \ - static void TestOneProtoInput(arg); \ - using FuzzerProtoType = std::remove_const<std::remove_reference< \ - std::function<decltype(TestOneProtoInput)>::argument_type>::type>::type; \ - DEFINE_CUSTOM_PROTO_MUTATOR_IMPL(use_binary, FuzzerProtoType) \ - DEFINE_CUSTOM_PROTO_CROSSOVER_IMPL(use_binary, FuzzerProtoType) \ - DEFINE_TEST_ONE_PROTO_INPUT_IMPL(use_binary, FuzzerProtoType) \ - DEFINE_POST_PROCESS_PROTO_MUTATION_IMPL(FuzzerProtoType) \ +#define DEFINE_PROTO_FUZZER_IMPL(use_binary, arg) \ + static void TestOneProtoInput(arg); \ + using FuzzerProtoType = \ + protobuf_mutator::libfuzzer::macro_internal::GetFirstParam< \ + decltype(&TestOneProtoInput)>::type; \ + DEFINE_CUSTOM_PROTO_MUTATOR_IMPL(use_binary, FuzzerProtoType) \ + DEFINE_CUSTOM_PROTO_CROSSOVER_IMPL(use_binary, FuzzerProtoType) \ + DEFINE_TEST_ONE_PROTO_INPUT_IMPL(use_binary, FuzzerProtoType) \ + DEFINE_POST_PROCESS_PROTO_MUTATION_IMPL(FuzzerProtoType) \ static void TestOneProtoInput(arg) namespace protobuf_mutator { @@ -123,6 +124,19 @@ struct PostProcessorRegistration { } }; +namespace macro_internal { + +template <typename T> +struct GetFirstParam; + +template <class Arg> +struct GetFirstParam<void (*)(Arg)> { + using type = typename std::remove_const< + typename std::remove_reference<Arg>::type>::type; +}; + +} // namespace macro_internal + } // namespace libfuzzer } // namespace protobuf_mutator |