Skip to content

Commit fa3583f

Browse files
author
MarcoFalke
committed
fuzz: Avoid negative NodeId in ConsumeNode
1 parent 205877e commit fa3583f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/test/fuzz/util.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ inline CAddress ConsumeAddress(FuzzedDataProvider& fuzzed_data_provider) noexcep
257257
template <bool ReturnUniquePtr = false>
258258
auto ConsumeNode(FuzzedDataProvider& fuzzed_data_provider, const std::optional<NodeId>& node_id_in = std::nullopt) noexcept
259259
{
260-
const NodeId node_id = node_id_in.value_or(fuzzed_data_provider.ConsumeIntegral<NodeId>());
260+
const NodeId node_id = node_id_in.value_or(fuzzed_data_provider.ConsumeIntegralInRange<NodeId>(0, std::numeric_limits<NodeId>::max()));
261261
const ServiceFlags local_services = ConsumeWeakEnum(fuzzed_data_provider, ALL_SERVICE_FLAGS);
262262
const SOCKET socket = INVALID_SOCKET;
263263
const CAddress address = ConsumeAddress(fuzzed_data_provider);

0 commit comments

Comments
 (0)