aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_protocol/block_queue.cpp
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-12-11 22:36:58 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-12-18 15:15:40 +0000
commit45a1c4c0885584554668c89bd6976474af01e2f5 (patch)
tree1e43812b37e0f2c2cb967f52133e0ddb09fbb61e /src/cryptonote_protocol/block_queue.cpp
parenttests: fix a buffer overread in a unit test (diff)
downloadmonero-45a1c4c0885584554668c89bd6976474af01e2f5.tar.xz
add empty container sanity checks when using front() and back()
Diffstat (limited to 'src/cryptonote_protocol/block_queue.cpp')
-rw-r--r--src/cryptonote_protocol/block_queue.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/cryptonote_protocol/block_queue.cpp b/src/cryptonote_protocol/block_queue.cpp
index bfff35456..9e38ffbcb 100644
--- a/src/cryptonote_protocol/block_queue.cpp
+++ b/src/cryptonote_protocol/block_queue.cpp
@@ -62,6 +62,7 @@ void block_queue::add_blocks(uint64_t height, std::list<cryptonote::block_comple
void block_queue::add_blocks(uint64_t height, uint64_t nblocks, const boost::uuids::uuid &connection_id, boost::posix_time::ptime time)
{
+ CHECK_AND_ASSERT_THROW_MES(nblocks > 0, "Empty span");
boost::unique_lock<boost::recursive_mutex> lock(mutex);
blocks.insert(span(height, nblocks, connection_id, time));
}