Skip to content

psbt: Add bounds check for non-witness UTXO output index#5617

Merged
apoelstra merged 1 commit intorust-bitcoin:masterfrom
erickcestari:fix-psbt-parse
Feb 17, 2026
Merged

psbt: Add bounds check for non-witness UTXO output index#5617
apoelstra merged 1 commit intorust-bitcoin:masterfrom
erickcestari:fix-psbt-parse

Conversation

@erickcestari
Copy link
Copy Markdown
Contributor

Add validation to ensure the vout specified in a transaction input does not exceed the number of outputs in the non-witness UTXO. This aligns with Bitcoin Core's PSBT deserialization behavior, which rejects PSBTs where the input references a non-existent output index.

The new NonWitnessUtxoOutOfBounds error provides detailed context including the input index, the referenced vout, and the actual number of outputs available in the non-witness UTXO.

Found by differential fuzzing using bitcoinfuzz.

Add validation to ensure the vout specified in a transaction input
does not exceed the number of outputs in the non-witness UTXO.
This aligns with Bitcoin Core's PSBT deserialization behavior, which
rejects PSBTs where the input references a non-existent output index.

The new NonWitnessUtxoOutOfBounds error provides detailed context
including the input index, the referenced vout, and the actual
number of outputs available in the non-witness UTXO.

Found by differential fuzzing using bitcoinfuzz.
@github-actions github-actions bot added C-bitcoin PRs modifying the bitcoin crate test labels Feb 4, 2026
Copy link
Copy Markdown
Member

@tcharding tcharding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 9cfc3f0 - I did not check the BIP matches the PR claim.

@tcharding
Copy link
Copy Markdown
Member

Thanks @erickcestari nice find!

Copy link
Copy Markdown
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 9cfc3f0; successfully ran local tests; nice

@apoelstra apoelstra merged commit a7a8c3b into rust-bitcoin:master Feb 17, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-bitcoin PRs modifying the bitcoin crate test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants