diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-12-03 10:02:01 +0000 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-12-04 11:39:50 +0100 |
commit | a1d7dd96ea89427f8b8e8553b5bf46302432c645 (patch) | |
tree | 164bac66c104a8aa124a982a2c04fe7398ceaf36 | |
parent | 75235a0759160fea2a15c2eaf9f7155f218b898a (diff) |
cid#1607257 Overflowed constant
this shouldn't happen unless the rdb is broken
Change-Id: I3e861d25a8c10243f03446ec8a7b44457186585a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177774
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
-rw-r--r-- | store/source/lockbyte.cxx | 6 | ||||
-rw-r--r-- | store/source/storcach.cxx | 4 |
2 files changed, 7 insertions, 3 deletions
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) |