mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
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
This commit is contained in:
parent
26ff28a028
commit
6c242da723
@ -4,11 +4,16 @@
|
|||||||
|
|
||||||
#include <test/fuzz/fuzz.h>
|
#include <test/fuzz/fuzz.h>
|
||||||
|
|
||||||
|
#include <netaddress.h>
|
||||||
|
#include <netbase.h>
|
||||||
#include <test/util/setup_common.h>
|
#include <test/util/setup_common.h>
|
||||||
#include <util/check.h>
|
#include <util/check.h>
|
||||||
|
#include <util/sock.h>
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <exception>
|
||||||
|
#include <memory>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@ -30,6 +35,9 @@ static TypeTestOneInput* g_test_one_input{nullptr};
|
|||||||
|
|
||||||
void initialize()
|
void initialize()
|
||||||
{
|
{
|
||||||
|
// Terminate immediately if a fuzzing harness ever tries to create a TCP socket.
|
||||||
|
CreateSock = [](const CService&) -> std::unique_ptr<Sock> { std::terminate(); };
|
||||||
|
|
||||||
// Terminate immediately if a fuzzing harness ever tries to perform a DNS lookup.
|
// Terminate immediately if a fuzzing harness ever tries to perform a DNS lookup.
|
||||||
g_dns_lookup = [](const std::string& name, bool allow_lookup) {
|
g_dns_lookup = [](const std::string& name, bool allow_lookup) {
|
||||||
if (allow_lookup) {
|
if (allow_lookup) {
|
||||||
|
Loading…
Reference in New Issue
Block a user