From 51ea44f01c0d63aeacb8657b6305040b3419e9f1 Mon Sep 17 00:00:00 2001 From: Jonas Schnelli Date: Mon, 27 Mar 2017 14:00:14 +0200 Subject: [PATCH] Use "return false" instead assert() in CWallet::SignTransaction --- src/wallet/wallet.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 186d3c5cd..d415bb09c 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2263,7 +2263,9 @@ bool CWallet::SignTransaction(CMutableTransaction &tx) int nIn = 0; for (auto& input : tx.vin) { std::map::const_iterator mi = mapWallet.find(input.prevout.hash); - assert(mi != mapWallet.end() && input.prevout.n < mi->second.tx->vout.size()); + if(mi == mapWallet.end() || input.prevout.n >= mi->second.tx->vout.size()) { + return false; + } const CScript& scriptPubKey = mi->second.tx->vout[input.prevout.n].scriptPubKey; const CAmount& amount = mi->second.tx->vout[input.prevout.n].nValue; SignatureData sigdata;