mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-19 09:53:47 +01:00
Merge bitcoin/bitcoin#22493: fuzz: Extend addrman fuzz test with deserialize
aaaa9c6019
fuzz: Extend addrman fuzz test with deserialize (MarcoFalke) Pull request description: Requested on IRC: ``` [18:01] <vasild> => I think there is a good chance fuzzing addrman unserialize will find more bugs [18:04] <sipa> definitely ACKs for top commit: jonatack: ACKaaaa9c6019
per `git diff fa74025 aaaa9c6` vasild: ACKaaaa9c6019
Tree-SHA512: f57d0aecf22a933e48d3181d7398218949588dd0de31218d1d28c825649e55fd60b0de6fbc92d2497cf5639a4adc2061c9bf8216546a2be916feac4f03f16e8f
This commit is contained in:
commit
bfa52cbddf
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user