aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core/blockchain_storage.cpp
diff options
context:
space:
mode:
authorThomas Winget <tewinget@gmail.com>2014-09-27 17:46:12 -0400
committerThomas Winget <tewinget@gmail.com>2014-09-30 16:21:37 -0400
commit7568f89c5559a667c53dfaa6d1bef27fe3b4ae86 (patch)
tree4046f5242a9d587f96710fc1819b3ab9ea988275 /src/cryptonote_core/blockchain_storage.cpp
parentb261d9207ba5cdc0334fab403204971f79b6ca03 (diff)
downloadmonzero-core-7568f89c5559a667c53dfaa6d1bef27fe3b4ae86.tar.gz
monzero-core-7568f89c5559a667c53dfaa6d1bef27fe3b4ae86.tar.xz
monzero-core-7568f89c5559a667c53dfaa6d1bef27fe3b4ae86.zip
Fixed segfault with checkpoints loading
Bounds checking on blockchain_storage' m_blocks.size() when validating against checkpoints. Also moved initial json & DNS checkpoints load to after blockchain init.
Diffstat (limited to 'src/cryptonote_core/blockchain_storage.cpp')
-rw-r--r--src/cryptonote_core/blockchain_storage.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/cryptonote_core/blockchain_storage.cpp b/src/cryptonote_core/blockchain_storage.cpp
index 5dfda08ba..1165a9035 100644
--- a/src/cryptonote_core/blockchain_storage.cpp
+++ b/src/cryptonote_core/blockchain_storage.cpp
@@ -1793,6 +1793,12 @@ bool blockchain_storage::update_checkpoints(const std::string& file_path)
for (const auto& pt : points)
{
+ // if the checkpoint is for a block we don't have yet, move on
+ if (pt.first >= m_blocks.size())
+ {
+ continue;
+ }
+
if (!m_checkpoints.check_block(pt.first, get_block_hash(m_blocks[pt.first].bl)))
{
// if we're enforcing dns checkpoints, roll back to a couple of blocks before the checkpoint