diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-11-23 11:35:15 +0100 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-12-01 12:14:55 +0100 |
commit | fa3583f856e34b6c6134745da14f5206cf71fa3e (patch) | |
tree | 243ddc9229308e0f68485b092ed63ae5a6625a5b /src/test/fuzz/util.h | |
parent | 205877e55f7a5cab1f64f98d5305520744be06d2 (diff) |
fuzz: Avoid negative NodeId in ConsumeNode
Diffstat (limited to 'src/test/fuzz/util.h')
-rw-r--r-- | src/test/fuzz/util.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/test/fuzz/util.h b/src/test/fuzz/util.h index 40aaeac63f..e6edaa7ade 100644 --- a/src/test/fuzz/util.h +++ b/src/test/fuzz/util.h @@ -257,7 +257,7 @@ inline CAddress ConsumeAddress(FuzzedDataProvider& fuzzed_data_provider) noexcep template <bool ReturnUniquePtr = false> auto ConsumeNode(FuzzedDataProvider& fuzzed_data_provider, const std::optional<NodeId>& node_id_in = std::nullopt) noexcept { - const NodeId node_id = node_id_in.value_or(fuzzed_data_provider.ConsumeIntegral<NodeId>()); + const NodeId node_id = node_id_in.value_or(fuzzed_data_provider.ConsumeIntegralInRange<NodeId>(0, std::numeric_limits<NodeId>::max())); const ServiceFlags local_services = ConsumeWeakEnum(fuzzed_data_provider, ALL_SERVICE_FLAGS); const SOCKET socket = INVALID_SOCKET; const CAddress address = ConsumeAddress(fuzzed_data_provider); |