Skip to content

Commit

Permalink
Merge pull request #8421
Browse files Browse the repository at this point in the history
bd1e7c5 wallet2: prevent crash when reading tx w/fewer outputs than expected (j-berman)
  • Loading branch information
luigi1111 committed Jul 13, 2022
2 parents 6fed8c2 + bd1e7c5 commit cfdee9b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/wallet/wallet2.h
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,8 @@ namespace tools
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;
Expand Down

0 comments on commit cfdee9b

Please sign in to comment.