-
Notifications
You must be signed in to change notification settings - Fork 38.7k
psbt: Fix PSBTInputSignedAndVerified bounds assert
#34272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The previous `assert` used `>=`, allowing `input_index == psbt.inputs.size()` and out-of-bounds access in `psbt.inputs[input_index]`. Found during review: bitcoin#31650 (comment)
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code Coverage & BenchmarksFor details see: https://corecheck.dev/bitcoin/bitcoin/pulls/34272. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please copy-paste |
|
utACK 2f5b1c5 |
|
lgtm ACK 2f5b1c5 This is just a refactor/doc change, because the UB can not be reached in the current code-base, and is assumed to be unreachable anyway (due to the use of |
|
FWIW I think I hit this on the fuzz tests here: https://github.com/willcl-ark/bitcoin/actions/runs/20883835381/job/60004100089#step:10:5614 So it may be possible for this to cause CI failure, at least. |
|
@willcl-ark No, that is #33999 from the input fuzz_corpora/psbt/3fa30f92df4e391124a56b76cc3db3eb71b5d69c from commit bitcoin-core/qa-assets@00c335c |
ah ok i see, thanks. |
|
ACK 2f5b1c5 |
The previous `assert` used `>=`, allowing `input_index == psbt.inputs.size()` and out-of-bounds access in `psbt.inputs[input_index]`. Found during review: bitcoin#31650 (comment) Github-Pull: bitcoin#34272 Rebased-From: 2f5b1c5
|
Backported to 30.x in #34283. |
This PR fixes an off-by-one in a debug assertion in
PSBTInputSignedAndVerified.The function indexes
psbt.inputs[input_index], so the assertion must not allow indexing atpsbt.inputs.size().Found during review: #31650 (comment)