27 return fuzzed_data_provider.ConsumeIntegralInRange<int64_t>(std::numeric_limits<int64_t>::min(), std::numeric_limits<int32_t>::max());
33 static const auto testing_setup = MakeNoLogFileContext<>();
49 const bool start_with_corrupted_banlist{fuzzed_data_provider.ConsumeBool()};
50 bool force_read_and_write_to_err{
false};
51 if (start_with_corrupted_banlist) {
53 fuzzed_data_provider.ConsumeRandomLengthString()));
55 force_read_and_write_to_err = fuzzed_data_provider.ConsumeBool();
56 if (force_read_and_write_to_err) {
57 banlist_file =
fs::path{
"path"} /
"to" /
"inaccessible" /
"fuzzed_banlist";
62 BanMan ban_man{banlist_file,
nullptr, ConsumeBanTimeOffset(fuzzed_data_provider)};
72 ConsumeBanTimeOffset(fuzzed_data_provider), fuzzed_data_provider.ConsumeBool());
76 ConsumeBanTimeOffset(fuzzed_data_provider), fuzzed_data_provider.ConsumeBool());
79 ban_man.ClearBanned();
95 ban_man.GetBanned(banmap);
98 ban_man.DumpBanlist();
104 if (!force_read_and_write_to_err) {
105 ban_man.DumpBanlist();
108 ban_man.GetBanned(banmap);
109 BanMan ban_man_read{banlist_file,
nullptr, 0};
111 ban_man_read.GetBanned(banmap_read);
112 assert(banmap == banmap_read);
const fs::path & GetDataDirNet() const
Get data directory path with appended network identifier.
Path class wrapper to block calls to the fs::path(std::string) implicit constructor and the fs::path:...
#define LIMITED_WHILE(condition, limit)
Can be used to limit a theoretically unbounded loop.
static std::string PathToString(const path &path)
Convert path object to a byte string.
std::map< CSubNet, CBanEntry > banmap_t
bool WriteBinaryFile(const fs::path &filename, const std::string &data)
Write contents of std::string to a file.
FUZZ_TARGET_INIT(banman, initialize_banman)
static bool operator==(const CBanEntry &lhs, const CBanEntry &rhs)
CNetAddr ConsumeNetAddr(FuzzedDataProvider &fuzzed_data_provider) noexcept
CSubNet ConsumeSubNet(FuzzedDataProvider &fuzzed_data_provider) noexcept
int64_t ConsumeTime(FuzzedDataProvider &fuzzed_data_provider, const std::optional< int64_t > &min, const std::optional< int64_t > &max) noexcept
size_t CallOneOf(FuzzedDataProvider &fuzzed_data_provider, Callables... callables)
void SetMockTime(int64_t nMockTimeIn)
DEPRECATED Use SetMockTime with chrono type.