summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-10-05 20:26:57 +0100
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-10-06 17:13:50 +0200
commit7661789352187e28a5f3daedcb7c3e4956d6d2c5 (patch)
tree6edf1825ff657ac2e640ffa47f251ddc1e180987
parente32ab825cb0566b55011f630ed7b79df0fd6e04c (diff)
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.mcnamara@collabora.com> Tested-by: Jenkins
-rw-r--r--sc/source/ui/docshell/docfunc.cxx3
-rw-r--r--starmath/source/cursor.cxx4
-rw-r--r--sw/source/core/crsr/trvlfnfl.cxx2
-rw-r--r--vcl/source/graphic/GraphicObject2.cxx9
4 files changed, 11 insertions, 7 deletions
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();