aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2017-12-02 09:21:55 +0200
committerRiccardo Spagni <ric@spagni.net>2017-12-02 09:21:55 +0200
commit0bf4d6deea179cbc3caa70ae64f4ce0460a7ef3d (patch)
tree32ebebbef660cdd986da35b50e30cb85034b190f /src
parentMerge pull request #2863 (diff)
parentwallet2: check generate_key_derivation return value (diff)
downloadmonero-0bf4d6deea179cbc3caa70ae64f4ce0460a7ef3d.tar.xz
Merge pull request #2828
6cbe7bcd wallet2: check generate_key_derivation return value (moneromooo-monero)
Diffstat (limited to 'src')
-rw-r--r--src/wallet/wallet2.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index 3a8662890..4ad7ede9c 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -886,7 +886,12 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote
tools::threadpool::waiter waiter;
const cryptonote::account_keys& keys = m_account.get_keys();
crypto::key_derivation derivation;
- generate_key_derivation(tx_pub_key, keys.m_view_secret_key, derivation);
+ if (!generate_key_derivation(tx_pub_key, keys.m_view_secret_key, derivation))
+ {
+ MWARNING("Failed to generate key derivation from tx pubkey, skipping");
+ static_assert(sizeof(derivation) == sizeof(rct::key), "Mismatched sizes of key_derivation and rct::key");
+ memcpy(&derivation, rct::identity().bytes, sizeof(derivation));
+ }
// additional tx pubkeys and derivations for multi-destination transfers involving one or more subaddresses
std::vector<crypto::public_key> additional_tx_pub_keys = get_additional_tx_pub_keys_from_extra(tx);
@@ -894,7 +899,11 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote
for (size_t i = 0; i < additional_tx_pub_keys.size(); ++i)
{
additional_derivations.push_back({});
- generate_key_derivation(additional_tx_pub_keys[i], keys.m_view_secret_key, additional_derivations.back());
+ if (!generate_key_derivation(additional_tx_pub_keys[i], keys.m_view_secret_key, additional_derivations.back()))
+ {
+ MWARNING("Failed to generate key derivation from tx pubkey, skipping");
+ additional_derivations.pop_back();
+ }
}
if (miner_tx && m_refresh_type == RefreshNoCoinbase)