Review report

core: PR #36631

1 suggestion

Earlier concerns neither republished nor resolved: 1 suggestion. See the Run archive for their assessments.

Optional improvements

Link

[suggestion] · PSBT mutations are truncated without preserving map boundaries

Near libFuzzer’s input-length limit, a growth mutation can cut a PSBT mid-record or mid-map, preventing deserialization from reaching trailing maps and final count checks.

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

Details and suggested fix

PSBTCustomMutator serializes the mutated maps, then truncates the bytes to max_size without regard to record or map boundaries. Growth mutations such as adding a known record, duplicating a record, adding a map, or enlarging a key or value can exceed the limit. Because this target has a custom mutator, restore_default_len_control leaves -len_control off; the default maximum is 4096 bytes unless -max_len or a larger corpus raises it. PartiallySignedTransaction::Unserialize parses only the complete maps before the cut, then throws when it reaches the cut, so trailing maps and final input/output count checks are not reached. If libFuzzer keeps the result, the next ParsePSBT drops the cut map. This lowers mutation quality near the limit, but the returned size still satisfies the mutator contract. Before resizing, fall back to FuzzDefaultMutate when out.size() > max_size; data has not yet been written at that point.


Coverage details

Earlier concerns

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