From 6e512c9558c7d43bef640610588320ee0e567092 Mon Sep 17 00:00:00 2001 From: Disconnect3d Date: Thu, 6 Jan 2022 15:57:01 +0100 Subject: [PATCH] Fix oss-fuzz build compilation errors (#18919) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR fixes two compilation error that are happening in the oss-fuzz build of Envoy. Note that the latest oss-fuzz build errors out with only the error related to AsyncStream but AFAIR when it is fixed, a different compilation error has to be fixed which I fixed in the first commit that changes the socket.h file. Fixes an oss-fuzz Envoy compilation error: ``` Execution platform: @local_config_platform//:host In file included from source/common/network/socket_option_impl.cc:1: In file included from ./source/common/network/socket_option_impl.h:6: In file included from ./envoy/network/listen_socket.h:14: ./envoy/network/socket.h:26:3: error: definition of implicit copy assignment operator for 'SocketOptionName' is deprecated because it has a user-declared copy constructor [-Werror,-Wdeprecated-copy] SocketOptionName(const SocketOptionName&) = default; ^ source/common/network/socket_option_impl.cc:52:14: note: in implicit copy assignment operator for 'Envoy::Network::SocketOptionName' first required here info.name_ = optname_; ^ 1 error generated. INFO: Elapsed time: 2620.084s, Critical Path: 126.35s INFO: 4237 processes: 154 internal, 4083 local. FAILED: Build did NOT complete successfully ERROR:root:Building fuzzers failed. ``` Signed-off-by: disconnect3d * types_async_client.h: fix deprecated defaulted copy ctor Fixes an oss-fuzz Envoy compilation error: ``` Step #3 - "compile-afl-address-x86_64": Execution platform: @local_config_platform//:host Step #3 - "compile-afl-address-x86_64": In file included from source/extensions/filters/http/ext_proc/client_impl.cc:1: Step #3 - "compile-afl-address-x86_64": In file included from ./source/extensions/filters/http/ext_proc/client_impl.h:11: Step #3 - "compile-afl-address-x86_64": ./source/common/grpc/typed_async_client.h:38:3: error: definition of implicit copy assignment operator for 'AsyncStream' is deprecated because it has a user-declared copy constructor [-Werror,-Wdeprecated-copy] Step #3 - "compile-afl-address-x86_64": AsyncStream(const AsyncStream& other) = default; Step #3 - "compile-afl-address-x86_64":  ^ Step #3 - "compile-afl-address-x86_64": source/extensions/filters/http/ext_proc/client_impl.cc:34:11: note: in implicit copy assignment operator for 'Envoy::Grpc::AsyncStream' first required here Step #3 - "compile-afl-address-x86_64": stream_ = client_.start(*descriptor, *this, options); Step #3 - "compile-afl-address-x86_64":  ^ Step #3 - "compile-afl-address-x86_64": 1 error generated. ``` Signed-off-by: disconnect3d * socket.h: delete default assignment operator Signed-off-by: disconnect3d * typed_async_client.h: remove default assignment op Signed-off-by: disconnect3d Signed-off-by: Josh Perry --- envoy/network/socket.h | 2 -- source/common/grpc/typed_async_client.h | 2 -- 2 files changed, 4 deletions(-) diff --git a/envoy/network/socket.h b/envoy/network/socket.h index 3cfdf9e4e858..308cede89573 100644 --- a/envoy/network/socket.h +++ b/envoy/network/socket.h @@ -23,8 +23,6 @@ namespace Network { // avoid #ifdef proliferation. struct SocketOptionName { SocketOptionName() = default; - SocketOptionName(const SocketOptionName&) = default; - SocketOptionName& operator=(const SocketOptionName&) = default; SocketOptionName(int level, int option, const std::string& name) : value_(std::make_tuple(level, option, name)) {} diff --git a/source/common/grpc/typed_async_client.h b/source/common/grpc/typed_async_client.h index f41a7cc7de73..9a385bb2afc7 100644 --- a/source/common/grpc/typed_async_client.h +++ b/source/common/grpc/typed_async_client.h @@ -35,8 +35,6 @@ template class AsyncStream /* : public RawAsyncStream */ { public: AsyncStream() = default; AsyncStream(RawAsyncStream* stream) : stream_(stream) {} - AsyncStream(const AsyncStream& other) = default; - AsyncStream& operator=(const AsyncStream&) = default; void sendMessage(const Protobuf::Message& request, bool end_stream) { Internal::sendMessageUntyped(stream_, std::move(request), end_stream); }