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: https://github.com/bitcoin/bitcoin/pull/31650#discussion_r2685892867
This commit is contained in:
1 file changed
+1
-1
+1
-1
@@ -325,7 +325,7 @@ bool PSBTInputSigned(const PSBTInput& input)
|
|||||||
bool PSBTInputSignedAndVerified(const PartiallySignedTransaction psbt, unsigned int input_index, const PrecomputedTransactionData* txdata)
|
bool PSBTInputSignedAndVerified(const PartiallySignedTransaction psbt, unsigned int input_index, const PrecomputedTransactionData* txdata)
|
||||||
{
|
{
|
||||||
CTxOut utxo;
|
CTxOut utxo;
|
||||||
assert(psbt.inputs.size() >= input_index);
|
assert(input_index < psbt.inputs.size());
|
||||||
const PSBTInput& input = psbt.inputs[input_index];
|
const PSBTInput& input = psbt.inputs[input_index];
|
||||||
|
|
||||||
if (input.non_witness_utxo) {
|
if (input.non_witness_utxo) {
|
||||||
|
|||||||
Reference in new issue
Block a user