diff options
author | Alexander Blair <snipa@jagtech.io> | 2020-01-16 17:31:35 -0800 |
---|---|---|
committer | Alexander Blair <snipa@jagtech.io> | 2020-01-16 17:31:35 -0800 |
commit | c4abfbfbe7a38a2eaec0ec1f9e919a5f2e73f908 (patch) | |
tree | 29dbd06d0e8eb5d3ad9449805c9ff2b907a97b6e /src | |
parent | Merge pull request #6120 (diff) | |
parent | blockchain: error out if the builtin hashes data size is wrong (diff) | |
download | monero-c4abfbfbe7a38a2eaec0ec1f9e919a5f2e73f908.tar.xz |
Merge pull request #6124
21d4c216 blockchain: error out if the builtin hashes data size is wrong (moneromooo-monero)
Diffstat (limited to 'src')
-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 7357e44d0..5070cc169 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -5079,7 +5079,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); |