Page MenuHomePhabricator

addrman: Avoid crash on corrupt data, Force Check after deserialize
ClosedPublic

Authored by Fabien on Oct 19 2022, 14:39.

Details

Summary
Assert should only be used for program internal logic errors, not to sanitize external user input.
The assert was introduced via the debug-only runtime option -checkaddrman in commit 803ef70, thus won't need a backport.
Also, it doesn't really make sense to continue when the deserialized addrman doesn't pass the sanity check.
For example, if nLastSuccess is negative, it would later result in integer overflows.

Backport of core#22734.

Depends on D12310.

Test Plan
ninja all check-all

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable