aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-03-07 15:41:19 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-03-07 15:49:13 +0000
commit3f6f90bb313aad478b41a538b7007f21009d7e65 (patch)
treeab7fdabaef6e20961300c921df09b71e9ad07fe8 /src
parentMerge pull request #4852 (diff)
downloadmonero-3f6f90bb313aad478b41a538b7007f21009d7e65.tar.xz
wallet2: do not use invalid keys as fake outs in rings
Diffstat (limited to 'src')
-rw-r--r--src/wallet/wallet2.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index 085e6075f..6353285b3 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -7019,6 +7019,17 @@ bool wallet2::tx_add_fake_output(std::vector<std::vector<tools::wallet2::get_out
CHECK_AND_ASSERT_MES(!outs.empty(), false, "internal error: outs is empty");
if (std::find(outs.back().begin(), outs.back().end(), item) != outs.back().end()) // don't add duplicates
return false;
+ // check the keys are valid
+ if (!rct::isInMainSubgroup(rct::pk2rct(output_public_key)))
+ {
+ MWARNING("Key " << output_public_key << " at index " << global_index << " is not in the main subgroup");
+ return false;
+ }
+ if (!rct::isInMainSubgroup(mask))
+ {
+ MWARNING("Commitment " << mask << " at index " << global_index << " is not in the main subgroup");
+ return false;
+ }
// if (is_output_blackballed(output_public_key)) // don't add blackballed outputs
// return false;
outs.back().push_back(item);