aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/fuzz/banman.cpp1
-rw-r--r--src/test/fuzz/connman.cpp13
-rw-r--r--src/test/fuzz/net.cpp2
-rw-r--r--src/test/fuzz/rbf.cpp1
-rw-r--r--src/test/net_tests.cpp10
5 files changed, 17 insertions, 10 deletions
diff --git a/src/test/fuzz/banman.cpp b/src/test/fuzz/banman.cpp
index fc4a1d9261..0776848a95 100644
--- a/src/test/fuzz/banman.cpp
+++ b/src/test/fuzz/banman.cpp
@@ -32,6 +32,7 @@ void initialize()
void test_one_input(const std::vector<uint8_t>& buffer)
{
FuzzedDataProvider fuzzed_data_provider{buffer.data(), buffer.size()};
+ SetMockTime(ConsumeTime(fuzzed_data_provider));
const fs::path banlist_file = GetDataDir() / "fuzzed_banlist.dat";
fs::remove(banlist_file);
{
diff --git a/src/test/fuzz/connman.cpp b/src/test/fuzz/connman.cpp
index bb97f58cf2..8154f21092 100644
--- a/src/test/fuzz/connman.cpp
+++ b/src/test/fuzz/connman.cpp
@@ -23,6 +23,7 @@ void initialize()
void test_one_input(const std::vector<uint8_t>& buffer)
{
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,18 +128,12 @@ 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;
}
diff --git a/src/test/fuzz/net.cpp b/src/test/fuzz/net.cpp
index 81e36b3f06..8b25eb3397 100644
--- a/src/test/fuzz/net.cpp
+++ b/src/test/fuzz/net.cpp
@@ -27,7 +27,7 @@ void initialize()
void test_one_input(const std::vector<uint8_t>& buffer)
{
FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
-
+ SetMockTime(ConsumeTime(fuzzed_data_provider));
const std::optional<CAddress> address = ConsumeDeserializable<CAddress>(fuzzed_data_provider);
if (!address) {
return;
diff --git a/src/test/fuzz/rbf.cpp b/src/test/fuzz/rbf.cpp
index 1fd88a5f7b..58167c394c 100644
--- a/src/test/fuzz/rbf.cpp
+++ b/src/test/fuzz/rbf.cpp
@@ -18,6 +18,7 @@
void test_one_input(const std::vector<uint8_t>& buffer)
{
FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
+ SetMockTime(ConsumeTime(fuzzed_data_provider));
std::optional<CMutableTransaction> mtx = ConsumeDeserializable<CMutableTransaction>(fuzzed_data_provider);
if (!mtx) {
return;
diff --git a/src/test/net_tests.cpp b/src/test/net_tests.cpp
index cec4a8df61..c86974ba5b 100644
--- a/src/test/net_tests.cpp
+++ b/src/test/net_tests.cpp
@@ -604,6 +604,16 @@ BOOST_AUTO_TEST_CASE(cnetaddr_unserialize_v2)
BOOST_CHECK_EQUAL(addr.ToString(), "fc00:1:2:3:4:5:6:7");
BOOST_REQUIRE(s.empty());
+ // Invalid CJDNS, wrong prefix.
+ s << MakeSpan(ParseHex("06" // network type (CJDNS)
+ "10" // address length
+ "aa000001000200030004000500060007" // address
+ ));
+ s >> addr;
+ BOOST_CHECK(addr.IsCJDNS());
+ BOOST_CHECK(!addr.IsValid());
+ BOOST_REQUIRE(s.empty());
+
// Invalid CJDNS, with bogus length.
s << MakeSpan(ParseHex("06" // network type (CJDNS)
"01" // address length