mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-21 14:34:49 +01:00
Merge bitcoin/bitcoin#22267: fuzz: Speed up crypto fuzz target
fa483e9f68
fuzz: Speed up crypto fuzz target (MarcoFalke) Pull request description: May fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=34962 Similar solution to https://github.com/bitcoin/bitcoin/pull/22005 ACKs for top commit: practicalswift: cr ACKfa483e9f68
: patch looks correct and rationale makes sense Tree-SHA512: 3788cf9f6ba0f7a0a217cd3a6a825839689425e99e4d6d657981d291a001b0da7c5abb50a68b4ee1c2a8300b87fb92e4e3ccc1171907792b40251e467c33bd53
This commit is contained in:
commit
6eafa81b32
1 changed files with 5 additions and 1 deletions
|
@ -19,6 +19,10 @@
|
|||
|
||||
FUZZ_TARGET(crypto)
|
||||
{
|
||||
// Hashing is expensive with sanitizers enabled, so limit the number of
|
||||
// calls
|
||||
int limit_max_ops{30};
|
||||
|
||||
FuzzedDataProvider fuzzed_data_provider{buffer.data(), buffer.size()};
|
||||
std::vector<uint8_t> data = ConsumeRandomLengthByteVector(fuzzed_data_provider);
|
||||
if (data.empty()) {
|
||||
|
@ -36,7 +40,7 @@ FUZZ_TARGET(crypto)
|
|||
SHA3_256 sha3;
|
||||
CSipHasher sip_hasher{fuzzed_data_provider.ConsumeIntegral<uint64_t>(), fuzzed_data_provider.ConsumeIntegral<uint64_t>()};
|
||||
|
||||
while (fuzzed_data_provider.ConsumeBool()) {
|
||||
while (--limit_max_ops >= 0 && fuzzed_data_provider.ConsumeBool()) {
|
||||
CallOneOf(
|
||||
fuzzed_data_provider,
|
||||
[&] {
|
||||
|
|
Loading…
Add table
Reference in a new issue