mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 04:22:55 +01:00
Merge bitcoin/bitcoin#21795: fuzz: Terminate immediately if a fuzzing harness tries to perform a DNS lookup (belt and suspenders)
3737d35fee283968f12e0772aa27aee4981fce41 fuzz: Terminate immediately if a fuzzing harness ever tries to perform a DNS lookup (belts and suspenders) (practicalswift) Pull request description: Terminate immediately if a fuzzing harness tries to perform a DNS lookup (belt and suspenders). Obviously this _should_ never happen, but if it _does_ happen we want immediate termination instead of a DNS lookup :) ACKs for top commit: MarcoFalke: review ACK 3737d35fee283968f12e0772aa27aee4981fce41 Tree-SHA512: 51cd2d32def7f9f052e02f99c354656af1f807cc9fdf592ab765e620bfe660f1ed26e0484763f94aba650424b44959eafaf352bfd0f81aa273e350510e97356e
This commit is contained in:
parent
f3bc9535da
commit
cc70886b4d
@ -8,6 +8,7 @@
|
||||
#include <util/check.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <unistd.h>
|
||||
#include <vector>
|
||||
|
||||
@ -29,6 +30,14 @@ static TypeTestOneInput* g_test_one_input{nullptr};
|
||||
|
||||
void initialize()
|
||||
{
|
||||
// Terminate immediately if a fuzzing harness ever tries to perform a DNS lookup.
|
||||
g_dns_lookup = [](const std::string& name, bool allow_lookup) {
|
||||
if (allow_lookup) {
|
||||
std::terminate();
|
||||
}
|
||||
return WrappedGetAddrInfo(name, false);
|
||||
};
|
||||
|
||||
if (std::getenv("PRINT_ALL_FUZZ_TARGETS_AND_ABORT")) {
|
||||
for (const auto& t : FuzzTargets()) {
|
||||
if (std::get<2>(t.second)) continue;
|
||||
|
Loading…
Reference in New Issue
Block a user