diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-07-19 13:18:28 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-07-19 18:18:24 +0200 |
commit | aaaa9c6019790a1a21a7b4ef01693ac9390ae6d0 (patch) | |
tree | f1dc19c4e29cb178134ad2a302247420e474cda2 /src | |
parent | 7e1ba37b5daceda222b138cbf61bbdeda87d21fd (diff) | |
download | bitcoin-aaaa9c6019790a1a21a7b4ef01693ac9390ae6d0.tar.xz |
fuzz: Extend addrman fuzz test with deserialize
Diffstat (limited to 'src')
-rw-r--r-- | src/test/fuzz/addrman.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/test/fuzz/addrman.cpp b/src/test/fuzz/addrman.cpp index db0b461873..9a983a3227 100644 --- a/src/test/fuzz/addrman.cpp +++ b/src/test/fuzz/addrman.cpp @@ -44,6 +44,17 @@ FUZZ_TARGET_INIT(addrman, initialize_addrman) addr_man.m_asmap.clear(); } } + if (fuzzed_data_provider.ConsumeBool()) { + const std::vector<uint8_t> serialized_data{ConsumeRandomLengthByteVector(fuzzed_data_provider)}; + CDataStream ds(serialized_data, SER_DISK, INIT_PROTO_VERSION); + const auto ser_version{fuzzed_data_provider.ConsumeIntegral<int32_t>()}; + ds.SetVersion(ser_version); + try { + ds >> addr_man; + } catch (const std::ios_base::failure&) { + addr_man.Clear(); + } + } while (fuzzed_data_provider.ConsumeBool()) { CallOneOf( fuzzed_data_provider, |