fuzz: don't connman.ReceiveMsgFrom oversized msg
What changed, and why it matters
This is a small fix to a Bitcoin Core fuzz test (an automated internal testing harness), not to the live network code. The fuzzer was sometimes creating fake P2P messages larger than the real protocol allows and passing them into a test helper. The change simply skips those oversized fake messages during fuzzing. It does not change how Bitcoin Core handles messages from actual peers on the network.
No production action required. Treat as routine fuzzing infrastructure improvement. If reviewing, confirm that ReceiveMsgFrom() already enforces MAX_PROTOCOL_MESSAGE_LENGTH in production code paths independently of this test.
Security signals we found
Test-only fuzz harness hardening
Oversized message guard added before ReceiveMsgFrom() in fuzz target
No change to production P2P message acceptance logic
Evidence from the diff
The commit modifies src/test/fuzz/p2p_private_broadcast.cpp. The fuzz target builds a CNetMessage and calls connman.ReceiveMsgFrom(). Because ConsumeTransaction() can generate payloads above MAX_PROTOCOL_MESSAGE_LENGTH, the fuzzer could previously feed ReceiveMsgFrom() an oversized net_msg. The patch adds a continue guard so oversized messages are discarded before the call. This is a test-only sanity check; no production networking or consensus code is altered.
Changed components
src/test/fuzz/p2p_private_broadcast.cppInspect captured patch +5 / −0
diff --git a/src/test/fuzz/p2p_private_broadcast.cpp b/src/test/fuzz/p2p_private_broadcast.cpp
index 72805d68..547b2fbe 100644
--- a/src/test/fuzz/p2p_private_broadcast.cpp
+++ b/src/test/fuzz/p2p_private_broadcast.cpp
@@ -232,6 +232,11 @@ FUZZ_TARGET(p2p_private_broadcast, .init = ::initialize)
net_msg->data = ConsumeRandomLengthByteVector(fuzzed_data_provider, MAX_PROTOCOL_MESSAGE_LENGTH);
}
connman.FlushSendBuffer(p2p_node);
+
+ // ConsumeTransaction() can produce messages larger than the
+ // maximum payload accepted by the P2P transport.
+ if (net_msg->data.size() > MAX_PROTOCOL_MESSAGE_LENGTH) continue;
+
(void)connman.ReceiveMsgFrom(p2p_node, std::move(*net_msg));
bool more_work{true};
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.