Skip to content

Commit 84be9a8

Browse files
author
MarcoFalke
committed
Merge bitcoin/bitcoin#22755: fuzz: Avoid timeout in blockfilter fuzz target
fa2547f fuzz: Avoid timeout in blockfilter fuzz target (MarcoFalke) Pull request description: Previously it would take 10 seconds to run this input, now it takes 10ms: [clusterfuzz-testcase-blockfilter-5022838196142080.log](https://github.com/bitcoin/bitcoin/files/7021883/clusterfuzz-testcase-blockfilter-5022838196142080.log) The fix is moving the `MatchAny` out of the hot loop. Also, to avoid unlimited runtime, cap the hot loop at 30k iterations. ACKs for top commit: GeneFerneau: Approach ACK [fa2547f](bitcoin/bitcoin@fa2547f) Tree-SHA512: a04e7388856930ec81222da8f05b665a923fe9482aeb4c55c9be4561aa7320a0703dbbf8d438ae92854e877a8e3b46777a29c0b652b8f34c29c2142cc5d63ccb
2 parents f046131 + fa2547f commit 84be9a8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/test/fuzz/blockfilter.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@ FUZZ_TARGET(blockfilter)
3636
(void)gcs_filter.GetEncoded();
3737
(void)gcs_filter.Match(ConsumeRandomLengthByteVector(fuzzed_data_provider));
3838
GCSFilter::ElementSet element_set;
39-
while (fuzzed_data_provider.ConsumeBool()) {
39+
LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 30000)
40+
{
4041
element_set.insert(ConsumeRandomLengthByteVector(fuzzed_data_provider));
41-
gcs_filter.MatchAny(element_set);
4242
}
43+
gcs_filter.MatchAny(element_set);
4344
}
4445
}

0 commit comments

Comments
 (0)