aboutsummaryrefslogtreecommitdiff
path: root/src/test/fuzz/util.h
diff options
context:
space:
mode:
authorpracticalswift <practicalswift@users.noreply.github.com>2021-04-14 22:18:43 +0000
committerpracticalswift <practicalswift@users.noreply.github.com>2021-04-14 22:21:17 +0000
commit6262182b3f1c9540291fb8de3bf7a785e7113c55 (patch)
treebf90f216aabca2113c3ba00f0b1f10c44fb370e7 /src/test/fuzz/util.h
parente7af2f35af95f4ca51e38c8ac5b05cad8be22489 (diff)
downloadbitcoin-6262182b3f1c9540291fb8de3bf7a785e7113c55.tar.xz
Avoid use of low file descriptor ids (which may be in use) in FuzzedSock and StaticContentsSock
Diffstat (limited to 'src/test/fuzz/util.h')
-rw-r--r--src/test/fuzz/util.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/test/fuzz/util.h b/src/test/fuzz/util.h
index adcdd71748..a3feddc21d 100644
--- a/src/test/fuzz/util.h
+++ b/src/test/fuzz/util.h
@@ -577,15 +577,15 @@ class FuzzedSock : public Sock
public:
explicit FuzzedSock(FuzzedDataProvider& fuzzed_data_provider) : m_fuzzed_data_provider{fuzzed_data_provider}
{
- m_socket = fuzzed_data_provider.ConsumeIntegral<SOCKET>();
+ m_socket = fuzzed_data_provider.ConsumeIntegralInRange<SOCKET>(INVALID_SOCKET - 1, INVALID_SOCKET);
}
~FuzzedSock() override
{
// Sock::~Sock() will be called after FuzzedSock::~FuzzedSock() and it will call
// Sock::Reset() (not FuzzedSock::Reset()!) which will call CloseSocket(m_socket).
- // Avoid closing an arbitrary file descriptor (m_socket is just a random number which
- // may concide with a real opened file descriptor).
+ // Avoid closing an arbitrary file descriptor (m_socket is just a random very high number which
+ // theoretically may concide with a real opened file descriptor).
Reset();
}