diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-05-21 09:00:16 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-05-21 09:00:18 +0200 |
commit | ac5f7f47c16fd62afafdc227acf437170a5efd3a (patch) | |
tree | 8445bd045b71877c2bedea94420e093901732e18 /src/test/fuzz | |
parent | 1cc38d3e01c7047d6a6c490c4d30ef729f443bf6 (diff) | |
parent | 393992b049d3bcf0b2a3439be128d13d6567f0b1 (diff) |
Merge bitcoin/bitcoin#21936: fuzz: Terminate immediately if a fuzzing harness tries to create a TCP socket (belt and suspenders)
393992b049d3bcf0b2a3439be128d13d6567f0b1 fuzz: Terminate immediately if a fuzzing harness ever tries to create a TCP socket (belt and suspenders) (practicalswift)
Pull request description:
Terminate immediately if a fuzzing harness ever to create a TCP socket (belt and suspenders).
Obviously this _should_ never happen, but if it _does_ happen we want immediate termination instead of a TCP socket :)
ACKs for top commit:
MarcoFalke:
ACK 393992b049d3bcf0b2a3439be128d13d6567f0b1
Tree-SHA512: 5bbff1f7e9a58b3eae24f742b7daf3fc870424c985f29bed5931e47a708d9c0984bfd8762f43658cffa9c69d32f86d56deb48bc7e43821e3398052174b6a160e
Diffstat (limited to 'src/test/fuzz')
-rw-r--r-- | src/test/fuzz/fuzz.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/test/fuzz/fuzz.cpp b/src/test/fuzz/fuzz.cpp index 0d8d960d56..631c861bb6 100644 --- a/src/test/fuzz/fuzz.cpp +++ b/src/test/fuzz/fuzz.cpp @@ -4,10 +4,15 @@ #include <test/fuzz/fuzz.h> +#include <netaddress.h> +#include <netbase.h> #include <test/util/setup_common.h> #include <util/check.h> +#include <util/sock.h> #include <cstdint> +#include <exception> +#include <memory> #include <unistd.h> #include <vector> @@ -29,6 +34,9 @@ static TypeTestOneInput* g_test_one_input{nullptr}; void initialize() { + // Terminate immediately if a fuzzing harness ever tries to create a TCP socket. + CreateSock = [](const CService&) -> std::unique_ptr<Sock> { std::terminate(); }; + bool should_abort{false}; if (std::getenv("PRINT_ALL_FUZZ_TARGETS_AND_ABORT")) { for (const auto& t : FuzzTargets()) { |