sc/source/ui/docshell/docfunc.cxx     |    3 +++
 starmath/source/cursor.cxx            |    4 ++--
 sw/source/core/crsr/trvlfnfl.cxx      |    2 +-
 vcl/source/graphic/GraphicObject2.cxx |    9 +++++----
 4 files changed, 11 insertions(+), 7 deletions(-)

New commits:
commit 7661789352187e28a5f3daedcb7c3e4956d6d2c5
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Sat Oct 5 20:26:57 2024 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Sun Oct 6 17:13:50 2024 +0200

    cid#1608598 silence Overflowed constant
    
    and
    
    cid#1607946 Overflowed constant
    cid#1608526 Overflowed integer argument
    cid#1608611 Overflowed integer argument
    
    Change-Id: Iec21df2f3d7dc8fba3872c6a70466ae12026a49d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174557
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Tested-by: Jenkins

diff --git a/sc/source/ui/docshell/docfunc.cxx 
b/sc/source/ui/docshell/docfunc.cxx
index 77e4e372bea3..0b16439f29cf 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -4736,7 +4736,10 @@ bool ScDocFunc::FillSeries( const ScRange& rRange, const 
ScMarkData* pTabMark,
             static_cast<SCSIZE>( aSourceArea.aEnd.Row() - 
aSourceArea.aStart.Row() + 1 ) :
             static_cast<SCSIZE>( aSourceArea.aEnd.Col() - 
aSourceArea.aStart.Col() + 1 );
         if ( nCount >= nTotLines )
+        {
+            assert(nTotLines > 0 && "coverity 2023.12.2");
             nCount = nTotLines - 1;
+        }
 
         switch (eDir)
         {
diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx
index b76c982d568a..7d7ec5a06ce7 100644
--- a/starmath/source/cursor.cxx
+++ b/starmath/source/cursor.cxx
@@ -711,7 +711,7 @@ bool SmCursor::InsertRow() {
     //Find parent and offset in parent
     SmStructureNode *pLineParent = pLine->GetParent();
     int nParentIndex = pLineParent->IndexOfSubNode(pLine);
-    assert(nParentIndex >= 0);
+    assert(nParentIndex >= 0 && nParentIndex < INT_MAX);
 
     //Discover the context of this command
     SmTableNode  *pTable  = nullptr;
@@ -726,7 +726,7 @@ bool SmCursor::InsertRow() {
         //NOTE: This hack might give problems if we stop ignoring SmAlignNode
         pTable = static_cast<SmTableNode*>(pLineParent->GetParent());
         nTableIndex = pTable->IndexOfSubNode(pLineParent);
-        assert(nTableIndex >= 0);
+        assert(nTableIndex >= 0 && nTableIndex < INT_MAX);
     }
     if(pLineParent->GetType() == SmNodeType::Matrix)
         pMatrix = static_cast<SmMatrixNode*>(pLineParent);
diff --git a/sw/source/core/crsr/trvlfnfl.cxx b/sw/source/core/crsr/trvlfnfl.cxx
index 46ba4a95002a..060d754fd82c 100644
--- a/sw/source/core/crsr/trvlfnfl.cxx
+++ b/sw/source/core/crsr/trvlfnfl.cxx
@@ -229,7 +229,7 @@ bool SwCursor::GotoNextFootnoteAnchor()
             {
                 // search backwards
                 pTextFootnote = nullptr;
-                while( nPos )
+                while (nPos > 0)
                 {
                     pTextFootnote = rFootnoteArr[ --nPos ];
                     if( CmpLE( *pTextFootnote, nNdPos, nCntPos ) )
diff --git a/vcl/source/graphic/GraphicObject2.cxx 
b/vcl/source/graphic/GraphicObject2.cxx
index a8dd186a3d93..fb2584d53037 100644
--- a/vcl/source/graphic/GraphicObject2.cxx
+++ b/vcl/source/graphic/GraphicObject2.cxx
@@ -364,11 +364,12 @@ bool GraphicObject::ImplDrawTiled(OutputDevice& rOut, 
const tools::Rectangle& rA
         rOut.IntersectClipRegion( rArea );
 
         // Paint all tiles
-
-
+        auto nOutAreaWidth = aOutArea.GetWidth();
+        auto nOutAreaHeight = aOutArea.GetHeight();
+        assert(nOutAreaWidth >= 0 && nOutAreaHeight >= 0 && "coverity 
2023.12.2");
         bRet = ImplDrawTiled(rOut, aOutStart,
-                             (aOutArea.GetWidth() + aOutArea.Left() - 
aOutStart.X() + rSizePixel.Width() - 1) / rSizePixel.Width(),
-                             (aOutArea.GetHeight() + aOutArea.Top() - 
aOutStart.Y() + rSizePixel.Height() - 1) / rSizePixel.Height(),
+                             (nOutAreaWidth + aOutArea.Left() - aOutStart.X() 
+ rSizePixel.Width() - 1) / rSizePixel.Width(),
+                             (nOutAreaHeight + aOutArea.Top() - aOutStart.Y() 
+ rSizePixel.Height() - 1) / rSizePixel.Height(),
                              rSizePixel, pAttr);
 
         rOut.Pop();

Reply via email to