mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
Merge bitcoin/bitcoin#22755: fuzz: Avoid timeout in blockfilter fuzz target
fa2547fc52b90b4bbde250803df24d7f665383a7 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:
parent
dd26a7a806
commit
f263bea244
@ -36,9 +36,10 @@ FUZZ_TARGET(blockfilter)
|
||||
(void)gcs_filter.GetEncoded();
|
||||
(void)gcs_filter.Match(ConsumeRandomLengthByteVector(fuzzed_data_provider));
|
||||
GCSFilter::ElementSet element_set;
|
||||
while (fuzzed_data_provider.ConsumeBool()) {
|
||||
LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 30000)
|
||||
{
|
||||
element_set.insert(ConsumeRandomLengthByteVector(fuzzed_data_provider));
|
||||
}
|
||||
gcs_filter.MatchAny(element_set);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user