3 suggestions
Earlier concerns neither republished nor resolved: 1 major finding · 1 suggestion. See the Run archive for their assessments.
Optional improvements
[suggestion] · visited_overflow leaves exclusive leaf ownership unexplained
The new tree-wide rejection relies on leaf-chain exclusivity that the existing reference-count comment does not explain; no valid wallet with shared leaf chains has been demonstrated.
Location: src/wallet/legacybdb.cpp:672 (head).
Details and suggested fix
OverflowPage documents entries as a reference count, but visited_overflow now rejects a second visit from any non-deleted leaf overflow record, whereas base followed each reference independently. Requiring version 9 and only SUBDB does not explain which references contribute to that count. Please document the BDB operation that raises it and why it cannot produce two followed leaf references to one chain in the accepted subset. Sharing confined to internal overflow separators would not establish a new incompatibility because InternalPage already rejects non-KEYDATA records at base. Sharing between live leaf records, if supported, would instead make migratewallet fail with Overflow page referenced more than once. If the exclusivity invariant does not hold, the rule needs to preserve legitimate sharing while still bounding cycles and repeated copying.
[suggestion] · Revisit tests do not distinguish tree-wide from page-local tracking
The new tests would still pass with per-parent btree duplicate rejection or per-leaf overflow tracking, leaving the intended tree-wide scope untested.
Location: src/wallet/test/db_tests.cpp:486 (head).
Details and suggested fix
bdbro_btree_page_referenced_twice repeats a child within one internal parent. bdbro_overflow_chain_shared_by_records puts both references on leaf page 3, and the other overflow revisit test exercises a self-loop within one chain. Thus, resetting visited_overflow for each leaf or checking duplicate children only within each parent would preserve these assertions while allowing cross-leaf copying or diamond re-parsing. Add a level-2 root with two distinct leaves whose live overflow values share a chain, and a level-3 diamond whose two level-2 parents share a leaf. Keep the record totals within the page bounds and assert the corresponding revisit error so each fixture tests tree-wide tracking.
[suggestion] · The preparatory fuzz fix follows three hardening commits
Source inspection shows that the first three hardening snapshots retain the pre-existing fuzz error gap; moving the standalone fix first would allow fuzzing those changes without these unrelated aborts.
Location: src/wallet/test/fuzz/wallet_bdb_parser.cpp:81 at f7e0d7e24b50 (commit) (commit).
Details and suggested fix
f7e0d7e24b505306cc35232c68e0eb097261489a only adds Overflow record has an impossible length and Overflow record data is larger than stated size to the wallet_bdb_parser allowlist. Both errors already exist at base, and its direct parent, 32e6ae0c0ed09ca64d2ca12d3fb9b1c47de03355 (page-record bounds), still rethrows them. Move this standalone harness fix ahead of 9bf31e0113ada62c2b7535afd7ecfb40213abc8b (btree revisits), and therefore also ahead of 0f53a3cbba074d2ae1677e7930fa5baee3817566 (overflow revisits). The patch has no dependency on those production changes; the earlier btree error appears only in its context. This preserves the final tree and the fix's separate backportable boundary while making each hardening snapshot easier to fuzz or bisect. The abort behavior follows from the source, not a recorded fuzz run.
Earlier concerns
Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.
- [major]: Reject repeated record spans before reading page entries
- [suggestion]: Page-fit checks omit layout overhead and record endpoints (earlier report)
Background
Ralph's summary of historical context for the behaviour affected by this change. The historical record reviewed here is incomplete.
Documented decisions
The earlier parser hardening deliberately used BDB's stored structural information to constrain traversal: child levels decrease toward level-one leaves, and accumulated overflow data must not exceed the item's declared total length. Its stated purpose was to reject circular references and impossible data lengths.
These are the historical constraints already present at the comparison base. They support level and total-item-length validation, but the inspected proposal does not establish the stronger assumptions now at issue: unique parents, exclusive overflow ownership, or aggregate per-page record bounds.
Ralph's inferences
The compatibility question concerns a restricted BDB subset, not arbitrary BDB databases: the parser accepts file-format version 9, page sizes from 512 through 65536 bytes, and metadata flags containing only SUBDB. It also requires reset log sequence numbers before reading without log recovery.
Any historical counterexample or supporting invariant must apply to this subset. In particular, layouts requiring DUP or DUPSORT flags are outside the accepted metadata configuration. File-format version 9 alone does not identify every BDB software release that can produce an accepted file.
Deleted records remain part of physical deserialization and the new size accounting, although their child pointers and overflow chains are skipped during subsequent traversal.
Compatibility of the aggregate byte limits therefore depends on physical layout rules for deleted entries as well as live entries. By contrast, the visited-page rules apply only to references actually followed. The inspected code establishes this distinction, but not the historical storage invariants needed to validate it across supported database states.
The existing overflow layout description is insufficient to infer exclusive ownership: it explicitly describes the entries field as a reference count. It separately describes overflow payload as beginning immediately after the page header.
The latter description supplies a code-level premise for a page-local payload-capacity bound. The reference-count description leaves a separate historical question about legitimate sharing; neither its existence nor duplicates being disabled, by itself, resolves whether two followed records may reference the same chain.