diff options
Diffstat (limited to 'src/test/fuzz/connman.cpp')
-rw-r--r-- | src/test/fuzz/connman.cpp | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/src/test/fuzz/connman.cpp b/src/test/fuzz/connman.cpp index 6521c3f3b2..fdf51d8558 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, 27)) { case 0: random_address = ConsumeAddress(fuzzed_data_provider); break; @@ -124,28 +125,18 @@ void test_one_input(const std::vector<uint8_t>& buffer) break; } case 25: - connman.SetBestHeight(fuzzed_data_provider.ConsumeIntegral<int>()); + connman.SetNetworkActive(fuzzed_data_provider.ConsumeBool()); break; case 26: - connman.SetMaxOutboundTarget(fuzzed_data_provider.ConsumeIntegral<uint64_t>()); + connman.SetServices(random_service, ConsumeWeakEnum(fuzzed_data_provider, ALL_SERVICE_FLAGS)); break; case 27: - connman.SetMaxOutboundTimeframe(fuzzed_data_provider.ConsumeIntegral<uint64_t>()); - break; - case 28: - connman.SetNetworkActive(fuzzed_data_provider.ConsumeBool()); - break; - case 29: - connman.SetServices(random_service, static_cast<ServiceFlags>(fuzzed_data_provider.ConsumeIntegral<uint64_t>())); - break; - case 30: 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(); |