Skip to content

Commit 4e3a175

Browse files
l0rincwillcl-ark
authored andcommitted
psbt: Fix PSBTInputSignedAndVerified bounds assert
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)
1 parent e392cfc commit 4e3a175

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/psbt.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ bool PSBTInputSigned(const PSBTInput& input)
325325
bool PSBTInputSignedAndVerified(const PartiallySignedTransaction psbt, unsigned int input_index, const PrecomputedTransactionData* txdata)
326326
{
327327
CTxOut utxo;
328-
assert(psbt.inputs.size() >= input_index);
328+
assert(input_index < psbt.inputs.size());
329329
const PSBTInput& input = psbt.inputs[input_index];
330330

331331
if (input.non_witness_utxo) {

0 commit comments

Comments
 (0)