diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-09-20 10:46:13 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-09-20 10:46:13 +0100 |
commit | e457aa51f40cd8eb9f02b8d8322d0fe4566014c9 (patch) | |
tree | bcb79599233164928319dd338a9fb1ecc12d0835 /src | |
parent | Merge pull request #2446 (diff) | |
download | monero-e457aa51f40cd8eb9f02b8d8322d0fe4566014c9.tar.xz |
blockchain: fix crash checking pre-validated txids
Diffstat (limited to 'src')
-rw-r--r-- | src/cryptonote_core/blockchain.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index 619dbdc07..274c8cd07 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -3276,7 +3276,7 @@ leave: // XXX old code adds miner tx here - int tx_index = 0; + size_t tx_index = 0; // Iterate over the block's transaction hashes, grabbing each // from the tx_pool and validating them. Each is then added // to txs. Keys spent in each are added to <keys> by the double spend check. @@ -3358,7 +3358,7 @@ leave: { // ND: if fast_check is enabled for blocks, there is no need to check // the transaction inputs, but do some sanity checks anyway. - if (memcmp(&m_blocks_txs_check[tx_index++], &tx_id, sizeof(tx_id)) != 0) + if (tx_index >= m_blocks_txs_check.size() || memcmp(&m_blocks_txs_check[tx_index++], &tx_id, sizeof(tx_id)) != 0) { MERROR_VER("Block with id: " << id << " has at least one transaction (id: " << tx_id << ") with wrong inputs."); //TODO: why is this done? make sure that keeping invalid blocks makes sense. |