aboutsummaryrefslogtreecommitdiff
path: root/src/blockchain_db/blockchain_db.cpp
diff options
context:
space:
mode:
authorflozilla <flozilla@users.noreply.github.com>2017-11-15 10:02:23 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-11-15 10:02:23 +0000
commitf9fad186080547a19fb3cc0f663763769b0830e5 (patch)
tree523e7c0f7c0abb159f8bdb6c30ea40bca5ca6926 /src/blockchain_db/blockchain_db.cpp
parentMerge pull request #2773 (diff)
downloadmonero-f9fad186080547a19fb3cc0f663763769b0830e5.tar.xz
blockchain_db: sanity check on tx/hash vector sizes
It could trip on a corrupt/crafted file if the user has disabled input verification.
Diffstat (limited to '')
-rw-r--r--src/blockchain_db/blockchain_db.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/blockchain_db/blockchain_db.cpp b/src/blockchain_db/blockchain_db.cpp
index c3f6e3d87..2fb43a4ba 100644
--- a/src/blockchain_db/blockchain_db.cpp
+++ b/src/blockchain_db/blockchain_db.cpp
@@ -194,6 +194,10 @@ uint64_t BlockchainDB::add_block( const block& blk
, const std::vector<transaction>& txs
)
{
+ // sanity
+ if (blk.tx_hashes.size() != txs.size())
+ throw new std::runtime_error("Inconsistent tx/hashes sizes");
+
block_txn_start(false);
TIME_MEASURE_START(time1);