diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-12-12 11:08:11 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-12-18 15:15:49 +0000 |
commit | b49ddc766de47b40aa705a0a0c0bb901c743908d (patch) | |
tree | edac56cb5d089c91a98164126b295b4cd6334b4d /src/ringct/rctOps.cpp | |
parent | check return value for generate_key_derivation and derive_public_key (diff) | |
download | monero-b49ddc766de47b40aa705a0a0c0bb901c743908d.tar.xz |
check accessing an element past the end of a container
Diffstat (limited to 'src/ringct/rctOps.cpp')
-rw-r--r-- | src/ringct/rctOps.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/ringct/rctOps.cpp b/src/ringct/rctOps.cpp index a7311482c..cc46d0aa7 100644 --- a/src/ringct/rctOps.cpp +++ b/src/ringct/rctOps.cpp @@ -76,6 +76,7 @@ namespace rct { //Generates a vector of secret key //Mainly used in testing keyV skvGen(size_t rows ) { + CHECK_AND_ASSERT_THROW_MES(rows > 0, "0 keys requested"); keyV rv(rows); size_t i = 0; crypto::rand(rows * sizeof(key), (uint8_t*)&rv[0]); @@ -351,6 +352,7 @@ namespace rct { //This takes the outputs and commitments //and hashes them into a 32 byte sized key key cn_fast_hash(const ctkeyV &PC) { + if (PC.empty()) return rct::hash2rct(crypto::cn_fast_hash("", 0)); key rv; cn_fast_hash(rv, &PC[0], 64*PC.size()); return rv; @@ -367,6 +369,7 @@ namespace rct { //put them in the key vector and it concatenates them //and then hashes them key cn_fast_hash(const keyV &keys) { + if (keys.empty()) return rct::hash2rct(crypto::cn_fast_hash("", 0)); key rv; cn_fast_hash(rv, &keys[0], keys.size() * sizeof(keys[0])); //dp(rv); |