diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-11-12 12:42:24 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-11-12 12:43:08 +0000 |
commit | 21d4c216198bcd04b0d824bb2863fc5198e9166b (patch) | |
tree | 8063b1824f3ac698d49369cb2a1c3a135a1be22f /src/cryptonote_core/blockchain.cpp | |
parent | Merge pull request #6088 (diff) | |
download | monero-21d4c216198bcd04b0d824bb2863fc5198e9166b.tar.xz |
blockchain: error out if the builtin hashes data size is wrong
Diffstat (limited to 'src/cryptonote_core/blockchain.cpp')
-rw-r--r-- | src/cryptonote_core/blockchain.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index d22158dfc..49415c6c6 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -5074,7 +5074,12 @@ void Blockchain::load_compiled_in_block_hashes(const GetCheckpointsCallback& get return; } const size_t size_needed = 4 + nblocks * (sizeof(crypto::hash) * 2); - if(nblocks > 0 && nblocks > (m_db->height() + HASH_OF_HASHES_STEP - 1) / HASH_OF_HASHES_STEP && checkpoints.size() >= size_needed) + if(checkpoints.size() != size_needed) + { + MERROR("Failed to load hashes - unexpected data size"); + return; + } + else if(nblocks > 0 && nblocks > (m_db->height() + HASH_OF_HASHES_STEP - 1) / HASH_OF_HASHES_STEP) { p += sizeof(uint32_t); m_blocks_hash_of_hashes.reserve(nblocks); |