unit_tests: add check for page size > 0 before dividing

Coverity 188426
This commit is contained in:
moneromooo-monero 2018-09-27 11:54:50 +00:00
parent d8b1ec8b8b
commit a085da3247
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3

View file

@ -158,6 +158,7 @@ TEST(mlocker, cross_page)
TEST(mlocker, redundant) TEST(mlocker, redundant)
{ {
const size_t page_size = epee::mlocker::get_page_size(); const size_t page_size = epee::mlocker::get_page_size();
ASSERT_TRUE(page_size > 0);
const size_t base_pages = epee::mlocker::get_num_locked_pages(); const size_t base_pages = epee::mlocker::get_num_locked_pages();
const size_t base_objects = epee::mlocker::get_num_locked_objects(); const size_t base_objects = epee::mlocker::get_num_locked_objects();
std::unique_ptr<char[]> data{new char[2 * page_size]}; std::unique_ptr<char[]> data{new char[2 * page_size]};