blockchain_db: sanity check on tx/hash vector sizes

It could trip on a corrupt/crafted file if the user has disabled
input verification.
This commit is contained in:
flozilla 2017-11-15 10:02:23 +00:00 committed by moneromooo-monero
parent 3abd6f1fd0
commit f9fad18608
No known key found for this signature in database
GPG Key ID: 686F07454D6CEFC3
1 changed files with 4 additions and 0 deletions

View File

@ -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);