sd/source/core/drawdoc2.cxx |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 2b67ec98a8136c15612d2cfa1396cb75d0d3baf3
Author:     Caolán McNamara <[email protected]>
AuthorDate: Mon Mar 16 09:13:55 2026 +0000
Commit:     Caolán McNamara <[email protected]>
CommitDate: Mon Mar 16 12:08:57 2026 +0100

    cid#1680368 silence Overflowed constant
    
    and
    
    cid#1680365 Overflowed constant
    
    Change-Id: Id59573858d032a85da70f50bead680fc2cc5c3bf
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201801
    Reviewed-by: Caolán McNamara <[email protected]>
    Tested-by: Jenkins

diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx
index 3f1d556ba902..46720b5fefd6 100644
--- a/sd/source/core/drawdoc2.cxx
+++ b/sd/source/core/drawdoc2.cxx
@@ -1643,6 +1643,7 @@ sal_uInt16 SdDrawDocument::GetOrInsertCanvasPage()
         return 0xffff;
 
     // move the canvas page to the top
+    assert(nCanvasPageIndex <= SAL_MAX_UINT16 / 2);
     sal_uInt16 nCanvasPageNum = 2 * nCanvasPageIndex + 1;
     MovePage(nCanvasPageNum, 1); // Canvas page
     MovePage(nCanvasPageNum + 1, 2); // Canvas notes page
@@ -1792,7 +1793,9 @@ void SdDrawDocument::connectPagePreviews()
         {
             SdrPageObj* pPageObj = static_cast<SdrPageObj*>(pObj);
             SdPage* pPage = 
static_cast<SdPage*>(pPageObj->GetReferencedPage());
-            sal_uInt16 nIndex = (pPage->GetPageNum() - 1) / 2 - 1; // without 
canvas page
+            sal_uInt16 nPageNum = pPage->GetPageNum();
+            assert(nPageNum >= 3 && nPageNum % 2 == 1);
+            sal_uInt16 nIndex = (nPageNum - 1) / 2 - 1; // without canvas page
             aPageOrder[nIndex] = pPageObj;
         }
     }

Reply via email to