diff options
Diffstat (limited to 'src/test/fuzz/connman.cpp')
-rw-r--r-- | src/test/fuzz/connman.cpp | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/test/fuzz/connman.cpp b/src/test/fuzz/connman.cpp index 6521c3f3b2..c5702cf98e 100644 --- a/src/test/fuzz/connman.cpp +++ b/src/test/fuzz/connman.cpp @@ -15,14 +15,15 @@ #include <cstdint> #include <vector> -void initialize() +void initialize_connman() { InitializeFuzzingContext(); } -void test_one_input(const std::vector<uint8_t>& buffer) +FUZZ_TARGET_INIT(connman, initialize_connman) { FuzzedDataProvider fuzzed_data_provider{buffer.data(), buffer.size()}; + SetMockTime(ConsumeTime(fuzzed_data_provider)); CConnman connman{fuzzed_data_provider.ConsumeIntegral<uint64_t>(), fuzzed_data_provider.ConsumeIntegral<uint64_t>(), fuzzed_data_provider.ConsumeBool()}; CAddress random_address; CNetAddr random_netaddr; @@ -31,7 +32,7 @@ void test_one_input(const std::vector<uint8_t>& buffer) CSubNet random_subnet; std::string random_string; while (fuzzed_data_provider.ConsumeBool()) { - switch (fuzzed_data_provider.ConsumeIntegralInRange<int>(0, 30)) { + switch (fuzzed_data_provider.ConsumeIntegralInRange<int>(0, 28)) { case 0: random_address = ConsumeAddress(fuzzed_data_provider); break; @@ -127,25 +128,19 @@ void test_one_input(const std::vector<uint8_t>& buffer) connman.SetBestHeight(fuzzed_data_provider.ConsumeIntegral<int>()); break; case 26: - connman.SetMaxOutboundTarget(fuzzed_data_provider.ConsumeIntegral<uint64_t>()); - break; - case 27: - connman.SetMaxOutboundTimeframe(fuzzed_data_provider.ConsumeIntegral<uint64_t>()); - break; - case 28: connman.SetNetworkActive(fuzzed_data_provider.ConsumeBool()); break; - case 29: + case 27: connman.SetServices(random_service, static_cast<ServiceFlags>(fuzzed_data_provider.ConsumeIntegral<uint64_t>())); break; - case 30: + case 28: connman.SetTryNewOutboundPeer(fuzzed_data_provider.ConsumeBool()); break; } } (void)connman.GetAddedNodeInfo(); (void)connman.GetBestHeight(); - (void)connman.GetExtraOutboundCount(); + (void)connman.GetExtraFullOutboundCount(); (void)connman.GetLocalServices(); (void)connman.GetMaxOutboundTarget(); (void)connman.GetMaxOutboundTimeframe(); |