diff --git a/store/source/lockbyte.cxx b/store/source/lockbyte.cxx index a786488ad7f6..a907c0f8ddc3 100644 --- a/store/source/lockbyte.cxx +++ b/store/source/lockbyte.cxx @@ -36,7 +36,11 @@ using namespace store; storeError ILockBytes::initialize (rtl::Reference< PageData::Allocator > & rxAllocator, sal_uInt16 nPageSize) { - OSL_PRECOND((STORE_MINIMUM_PAGESIZE <= nPageSize) && (nPageSize <= STORE_MAXIMUM_PAGESIZE), "invalid PageSize"); + if (nPageSize < STORE_MINIMUM_PAGESIZE || nPageSize > STORE_MAXIMUM_PAGESIZE) + { + SAL_WARN("store", "invalid PageSize"); + return store_E_InvalidParameter; + } return initialize_Impl (rxAllocator, nPageSize); } diff --git a/store/source/storcach.cxx b/store/source/storcach.cxx index 82b5dcea9ef9..5907cfc730e7 100644 --- a/store/source/storcach.cxx +++ b/store/source/storcach.cxx @@ -127,8 +127,8 @@ static constexpr int highbit(std::size_t n) { int k = 1; - if (n == 0) - return 0; + assert(n > 0 && "can never be called with n == 0"); + if constexpr (sizeof(n) == 8) { if (n & 0xffffffff00000000)