Skip to content

Commit 31ce305

Browse files
committed
Merge bitcoin#28952: fuzz: Avoid timeout in process_messages
fa82597 fuzz: Avoid timeout in process_messages (MarcoFalke) Pull request description: Reduce the number of messages per fuzz input. There should be no reason to have more messages than that. This should also avoid timeouts, such as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=64548. CC bitcoin#28812 ACKs for top commit: dergoegge: utACK fa82597 Tree-SHA512: eeff732f7b0bd9a71f23aeecbf813d31fe34d355b906fd0384a43075cbc3cebc46a26df741b0f337208d8b33b3e28210c9b9437e2eed77844f03131bb8f5f2a1
2 parents 26b7bcf + fa82597 commit 31ce305

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/test/fuzz/process_messages.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
// Copyright (c) 2020-2022 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 <net_processing.h>
88
#include <protocol.h>
9+
#include <script/script.h>
10+
#include <sync.h>
911
#include <test/fuzz/FuzzedDataProvider.h>
1012
#include <test/fuzz/fuzz.h>
1113
#include <test/fuzz/util.h>
@@ -14,9 +16,15 @@
1416
#include <test/util/net.h>
1517
#include <test/util/setup_common.h>
1618
#include <test/util/validation.h>
17-
#include <validation.h>
19+
#include <util/chaintype.h>
20+
#include <util/time.h>
1821
#include <validationinterface.h>
1922

23+
#include <ios>
24+
#include <string>
25+
#include <utility>
26+
#include <vector>
27+
2028
namespace {
2129
const TestingSetup* g_setup;
2230
} // namespace
@@ -55,7 +63,8 @@ FUZZ_TARGET(process_messages, .init = initialize_process_messages)
5563
connman.AddTestNode(p2p_node);
5664
}
5765

58-
LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 10000) {
66+
LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 30)
67+
{
5968
const std::string random_message_type{fuzzed_data_provider.ConsumeBytesAsString(CMessageHeader::COMMAND_SIZE).c_str()};
6069

6170
const auto mock_time = ConsumeTime(fuzzed_data_provider);

0 commit comments

Comments
 (0)