From 42b62ac28543dd862758f8b97fc181e49c8dddad Mon Sep 17 00:00:00 2001 From: Tim Ruffing Date: Tue, 22 May 2018 10:11:23 +0200 Subject: [PATCH] Ensure that input witness is present before accessing range proofs --- src/validation.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/validation.cpp b/src/validation.cpp index 76577c9a26..9abb28917a 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -854,6 +854,9 @@ bool VerifyAmounts(const CCoinsViewCache& cache, const CTransaction& tx, std::ve return false; } if (!issuance.nAmount.IsNull()) { + if (i >= tx.wit.vtxinwit.size()) { + return false; + } if (!VerifyIssuanceAmount(commit, gen, assetID, issuance.nAmount, tx.wit.vtxinwit[i].vchIssuanceAmountRangeproof, pvChecks, cacheStore)) { return false; } @@ -878,6 +881,9 @@ bool VerifyAmounts(const CCoinsViewCache& cache, const CTransaction& tx, std::ve return false; } + if (i >= tx.wit.vtxinwit.size()) { + return false; + } if (!VerifyIssuanceAmount(commit, gen, assetTokenID, issuance.nInflationKeys, tx.wit.vtxinwit[i].vchInflationKeysRangeproof, pvChecks, cacheStore)) { return false; }