Merge pull request #6124

21d4c216 blockchain: error out if the builtin hashes data size is wrong (moneromooo-monero)
release-0.8.0.2
Alexander Blair 5 years ago
commit c4abfbfbe7
No known key found for this signature in database
GPG Key ID: C64552D877C32479

@ -5079,7 +5079,12 @@ void Blockchain::load_compiled_in_block_hashes(const GetCheckpointsCallback& get
return; return;
} }
const size_t size_needed = 4 + nblocks * (sizeof(crypto::hash) * 2); 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); p += sizeof(uint32_t);
m_blocks_hash_of_hashes.reserve(nblocks); m_blocks_hash_of_hashes.reserve(nblocks);

Loading…
Cancel
Save