aboutsummaryrefslogtreecommitdiff
path: root/src/node/psbt.cpp
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2019-10-15 17:26:46 -0400
committerLuke Dashjr <luke-jr+git@utopios.org>2020-02-06 23:22:30 +0000
commitf5fb7fca969cd43318384bec46bb7687b1a529fd (patch)
treec33541bb633d97a5ab6e1c2383e6e9c377a4eefe /src/node/psbt.cpp
parent1cf77a2dc36c81b80a2f9af52ed99bd426061de8 (diff)
downloadbitcoin-f5fb7fca969cd43318384bec46bb7687b1a529fd.tar.xz
psbt: check output index is within bounds before accessing
Github-Pull: #17156 Rebased-From: deaa6dd144f5650b385658a0c4f9a014aff8dde2
Diffstat (limited to 'src/node/psbt.cpp')
-rw-r--r--src/node/psbt.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/node/psbt.cpp b/src/node/psbt.cpp
index 69fb1a28a9..ff7a38e40d 100644
--- a/src/node/psbt.cpp
+++ b/src/node/psbt.cpp
@@ -39,6 +39,10 @@ PSBTAnalysis AnalyzePSBT(PartiallySignedTransaction psbtx)
in_amt += utxo.nValue;
input_analysis.has_utxo = true;
} else {
+ if (input.non_witness_utxo && psbtx.tx->vin[i].prevout.n >= input.non_witness_utxo->vout.size()) {
+ result.SetInvalid(strprintf("PSBT is not valid. Input %u specifies invalid prevout", i));
+ return result;
+ }
input_analysis.has_utxo = false;
input_analysis.is_final = false;
input_analysis.next = PSBTRole::UPDATER;