Review report

bitcoin/bitcoin: PR #36631

1 suggestion

Earlier concerns neither republished nor resolved: 2 suggestions. See the Run archive for their assessments.

Optional improvements

Link

[suggestion] · Oversized structured mutations can be truncated mid-record

When serialized output exceeds max_size, the PSBT fuzz mutator can cut off a required record or separator, preventing the parser from reaching the complete appended field.

Location: src/test/fuzz/util/psbt.cpp:478 (head).

Details and suggested fix

Growing a near-limit input through record insertion, duplication, or key/value mutation can make the serialized result exceed max_size. The final resize ignores record and map boundaries, so it can split a length prefix or value, or remove a required separator. The parser then rejects the incomplete input, although it still parses earlier records; truncating only extra maps beyond the declared counts can be harmless. The template branch is also affected when -max_len is smaller than the selected template: with max_size == 5, it returns only the magic bytes. Prefer if (out.size() > max_size) return FuzzDefaultMutate(data, size, max_size); before the resize. The original buffer is still untouched there, so this safely reuses the existing raw-mutation path without guaranteeing a valid PSBT. This is a mutation-quality suggestion, not a mutator-contract violation. A later ParsePSBT drops the incomplete map, and the frequency and aggregate coverage cost remain unmeasured.


Coverage details

Earlier concerns

Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.