diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-08-21 19:34:13 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-08-21 19:25:33 +0200 |
commit | faa5fa9a78d6d23b4e9adea07fdfb34ead170a2f (patch) | |
tree | a580529d992ddb465c0edfcdfedf57dc830f93c1 /src/test/fuzz/banman.cpp | |
parent | f5a406f003a060325128db47552089b3254044e3 (diff) |
fuzz: Use LIMITED_WHILE instead of limit_max_ops
Diffstat (limited to 'src/test/fuzz/banman.cpp')
-rw-r--r-- | src/test/fuzz/banman.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/test/fuzz/banman.cpp b/src/test/fuzz/banman.cpp index 46a9f623ac..561cc83c72 100644 --- a/src/test/fuzz/banman.cpp +++ b/src/test/fuzz/banman.cpp @@ -41,10 +41,6 @@ static bool operator==(const CBanEntry& lhs, const CBanEntry& rhs) FUZZ_TARGET_INIT(banman, initialize_banman) { - // The complexity is O(N^2), where N is the input size, because each call - // might call DumpBanlist (or other methods that are at least linear - // complexity of the input size). - int limit_max_ops{300}; FuzzedDataProvider fuzzed_data_provider{buffer.data(), buffer.size()}; SetMockTime(ConsumeTime(fuzzed_data_provider)); fs::path banlist_file = gArgs.GetDataDirNet() / "fuzzed_banlist"; @@ -63,7 +59,11 @@ FUZZ_TARGET_INIT(banman, initialize_banman) { BanMan ban_man{banlist_file, /* client_interface */ nullptr, /* default_ban_time */ ConsumeBanTimeOffset(fuzzed_data_provider)}; - while (--limit_max_ops >= 0 && fuzzed_data_provider.ConsumeBool()) { + // The complexity is O(N^2), where N is the input size, because each call + // might call DumpBanlist (or other methods that are at least linear + // complexity of the input size). + LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 300) + { CallOneOf( fuzzed_data_provider, [&] { |