mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-09 05:14:22 +01:00
Merge bitcoin/bitcoin#22755: fuzz: Avoid timeout in blockfilter fuzz target
fa2547fc52
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
](fa2547fc52
) Tree-SHA512: a04e7388856930ec81222da8f05b665a923fe9482aeb4c55c9be4561aa7320a0703dbbf8d438ae92854e877a8e3b46777a29c0b652b8f34c29c2142cc5d63ccb
This commit is contained in:
commit
84be9a89c1
1 changed files with 3 additions and 2 deletions
|
@ -36,9 +36,10 @@ FUZZ_TARGET(blockfilter)
|
||||||
(void)gcs_filter.GetEncoded();
|
(void)gcs_filter.GetEncoded();
|
||||||
(void)gcs_filter.Match(ConsumeRandomLengthByteVector(fuzzed_data_provider));
|
(void)gcs_filter.Match(ConsumeRandomLengthByteVector(fuzzed_data_provider));
|
||||||
GCSFilter::ElementSet element_set;
|
GCSFilter::ElementSet element_set;
|
||||||
while (fuzzed_data_provider.ConsumeBool()) {
|
LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 30000)
|
||||||
|
{
|
||||||
element_set.insert(ConsumeRandomLengthByteVector(fuzzed_data_provider));
|
element_set.insert(ConsumeRandomLengthByteVector(fuzzed_data_provider));
|
||||||
gcs_filter.MatchAny(element_set);
|
|
||||||
}
|
}
|
||||||
|
gcs_filter.MatchAny(element_set);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue