Skip to content

Commit 34a9eeb

Browse files
fanquakevijaydasmp
authored andcommitted
Merge bitcoin#29079: fuzz: Limit p2p fuzz targets to MAX_PROTOCOL_MESSAGE_LENGTH
fa769d3 fuzz: Limit p2p fuzz targets to MAX_PROTOCOL_MESSAGE_LENGTH (MarcoFalke) Pull request description: Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=65039 ACKs for top commit: dergoegge: utACK fa769d3 brunoerg: crACK fa769d3 Tree-SHA512: 46f70d1acf4e2f95055c70162909010c6322f8504a810906e1ab4db470dc2525f9a494b8427b254279bc68b1c8b87338c943787fd5249df7113556740701a51a
1 parent e432dce commit 34a9eeb

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

src/test/fuzz/process_message.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
// Copyright (c) 2020 The Bitcoin Core developers
1+
// Copyright (c) 2020-present The Bitcoin Core developers
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

55
#include <consensus/consensus.h>
66
#include <net.h>
77
#include <protocol.h>
88
#include <script/script.h>
9-
#include <serialize.h>
10-
#include <streams.h>
119
#include <sync.h>
1210
#include <test/fuzz/FuzzedDataProvider.h>
1311
#include <test/fuzz/fuzz.h>
@@ -19,7 +17,6 @@
1917
#include <validationinterface.h>
2018
#include <version.h>
2119

22-
#include <atomic>
2320
#include <cstdlib>
2421
#include <iostream>
2522
#include <memory>
@@ -74,8 +71,7 @@ FUZZ_TARGET(process_message, .init = initialize_process_message)
7471

7572
CSerializedNetMsg net_msg;
7673
net_msg.m_type = random_message_type;
77-
// fuzzed_data_provider is fully consumed after this call, don't use it
78-
net_msg.data = fuzzed_data_provider.ConsumeRemainingBytes<unsigned char>();
74+
net_msg.data = ConsumeRandomLengthByteVector(fuzzed_data_provider, MAX_PROTOCOL_MESSAGE_LENGTH);
7975

8076
connman.FlushSendBuffer(p2p_node);
8177
(void)connman.ReceiveMsgFrom(p2p_node, std::move(net_msg));

src/test/fuzz/process_messages.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ FUZZ_TARGET(process_messages, .init = initialize_process_messages)
6262

6363
CSerializedNetMsg net_msg;
6464
net_msg.m_type = random_message_type;
65-
net_msg.data = ConsumeRandomLengthByteVector(fuzzed_data_provider);
65+
net_msg.data = ConsumeRandomLengthByteVector(fuzzed_data_provider, MAX_PROTOCOL_MESSAGE_LENGTH);
6666

6767
CNode& random_node = *PickValue(fuzzed_data_provider, peers);
6868

0 commit comments

Comments
 (0)