aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet2.h
diff options
context:
space:
mode:
authorj-berman <justinberman@protonmail.com>2022-07-05 21:39:59 -0700
committerj-berman <justinberman@protonmail.com>2022-07-05 21:39:59 -0700
commitbd1e7c56356a7b282403bcff934360ae5523b848 (patch)
treef88cfb5d15d45a0165f3e864ea47351fcee25d34 /src/wallet/wallet2.h
parentMerge pull request #8340 (diff)
downloadmonero-bd1e7c56356a7b282403bcff934360ae5523b848.tar.xz
wallet2: prevent crash when reading tx w/fewer outputs than expected
Diffstat (limited to '')
-rw-r--r--src/wallet/wallet2.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h
index e051946ad..81345f268 100644
--- a/src/wallet/wallet2.h
+++ b/src/wallet/wallet2.h
@@ -349,6 +349,8 @@ private:
uint64_t amount() const { return m_amount; }
const crypto::public_key get_public_key() const {
crypto::public_key output_public_key;
+ THROW_WALLET_EXCEPTION_IF(m_tx.vout.size() <= m_internal_output_index,
+ error::wallet_internal_error, "Too few outputs, outputs may be corrupted");
THROW_WALLET_EXCEPTION_IF(!get_output_public_key(m_tx.vout[m_internal_output_index], output_public_key),
error::wallet_internal_error, "Unable to get output public key from output");
return output_public_key;