Skip to content

Commit 100949a

Browse files
committed
Merge bitcoin/bitcoin#26012: fuzz: Avoid timeout in bitdeque fuzz target
fa4ba04 fuzz: Remove no-op call to get() (MacroFake) fa64228 fuzz: Avoid timeout in bitdeque fuzz target (MacroFake) Pull request description: I'd guess that any bug should be discoverable within `10` ops. However, `900` seems also better than no limit at all, which causes timeouts such as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=50892 ACKs for top commit: sipa: ACK fa4ba04 Tree-SHA512: f6bd25e78d5f04c6f88e9300c2fa3d0993a0911cb0fd1b414077adc0edde1a06ad72af5e2f50f0ab1324f91999ae57d879686c545b2e6c19ae7f637a8804bd48
2 parents 590d206 + fa4ba04 commit 100949a

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/test/fuzz/bitdeque.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

5-
#include <util/bitdeque.h>
6-
75
#include <random.h>
86
#include <test/fuzz/FuzzedDataProvider.h>
97
#include <test/fuzz/util.h>
8+
#include <util/bitdeque.h>
109

1110
#include <deque>
1211
#include <vector>
@@ -54,7 +53,8 @@ FUZZ_TARGET_INIT(bitdeque, InitRandData)
5453
--initlen;
5554
}
5655

57-
while (provider.remaining_bytes()) {
56+
LIMITED_WHILE(provider.remaining_bytes() > 0, 900)
57+
{
5858
{
5959
assert(deq.size() == bitdeq.size());
6060
auto it = deq.begin();
@@ -538,5 +538,4 @@ FUZZ_TARGET_INIT(bitdeque, InitRandData)
538538
}
539539
);
540540
}
541-
542541
}

src/test/fuzz/pow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ FUZZ_TARGET_INIT(pow_transition, initialize_pow)
114114
auto current_block{std::make_unique<CBlockIndex>(header)};
115115
current_block->pprev = blocks.empty() ? nullptr : blocks.back().get();
116116
current_block->nHeight = height;
117-
blocks.emplace_back(std::move(current_block)).get();
117+
blocks.emplace_back(std::move(current_block));
118118
}
119119
auto last_block{blocks.back().get()};
120120
unsigned int new_nbits{GetNextWorkRequired(last_block, nullptr, consensus_params)};

0 commit comments

Comments
 (0)