dbaccess/source/ui/browser/sbagrid.cxx |    2 +-
 sw/source/uibase/uno/unotxdoc.cxx      |    3 ++-
 vcl/source/treelist/imap2.cxx          |   13 +++++++++----
 3 files changed, 12 insertions(+), 6 deletions(-)

New commits:
commit 25552416c07a0841c32d71663cf2df75cbd174ea
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Mon Aug 26 21:02:36 2024 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Wed Aug 28 13:12:51 2024 +0200

    cid#1606904 silence Overflowed constant
    
    and
    
    cid#1606871 silence Overflowed constant
    
    Change-Id: Ibfa7b63bf6879b24dc28df9d889c6692ec5a4e23
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172512
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/dbaccess/source/ui/browser/sbagrid.cxx 
b/dbaccess/source/ui/browser/sbagrid.cxx
index 31bcf1ebfa6a..2657c9e741ff 100644
--- a/dbaccess/source/ui/browser/sbagrid.cxx
+++ b/dbaccess/source/ui/browser/sbagrid.cxx
@@ -924,7 +924,7 @@ void SbaGridControl::StartDrag( sal_Int8 _nAction, const 
Point& _rPosPixel )
         // my laziness says 'do it here'...)
         sal_Int32 nRow = GetRowAtYPosPixel(_rPosPixel.Y());
         sal_uInt16 nColPos = GetColumnAtXPosPixel(_rPosPixel.X());
-        sal_uInt16 nViewPos = (nColPos == BROWSER_INVALIDID) ? sal_uInt16(-1) 
: nColPos-1;
+        sal_uInt16 nViewPos = (nColPos == BROWSER_INVALIDID) ? sal_uInt16(-1) 
: sal_uInt16(nColPos-1);
             // 'the handle column' and 'no valid column' will both result in a 
view position of -1 !
 
         bool bCurrentRowVirtual = IsCurrentAppending() && IsModified();
diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index 6262416a480f..c76a313cc8ae 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -235,8 +235,9 @@ static std::unique_ptr<SwPrintUIOptions> 
lcl_GetPrintUIOptions(
     {
         sal_uInt16 nMax = nCurrentPage;
         const SwPageFrame *pPage = dynamic_cast<const 
SwPageFrame*>(pFrame->Lower());
-        while (pPage && nMax-- > 0)
+        while (pPage && nMax > 0)
         {
+            nMax--;
             if (pPage->getFrameArea().Height() == 0)
                 nCurrentPage--;
             pPage = static_cast<const SwPageFrame*>(pPage->GetNext());
commit 17181dfd0ff3abed78f00b5812e9652a8344bab9
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Mon Aug 26 21:06:26 2024 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Wed Aug 28 13:12:37 2024 +0200

    cid#1606906 Overflowed constant
    
    Change-Id: I8ac1aabb50c5ef061b8ac359cb9d7ce8fe66c62c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172511
    Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/vcl/source/treelist/imap2.cxx b/vcl/source/treelist/imap2.cxx
index c49aa45b5e6e..559658581ca5 100644
--- a/vcl/source/treelist/imap2.cxx
+++ b/vcl/source/treelist/imap2.cxx
@@ -416,12 +416,17 @@ void ImageMap::ImpReadNCSALine( std::string_view rLine )
     }
     else if ( aToken == "poly" )
     {
-        const sal_uInt16 nCount = comphelper::string::getTokenCount(aStr, ',') 
- 1;
+        const sal_Int32 nTokenCount = comphelper::string::getTokenCount(aStr, 
',');
         const OUString aURL( ImpReadNCSAURL( &pStr ) );
-        tools::Polygon aPoly( nCount );
+        tools::Polygon aPoly;
+        if (nTokenCount > 0)
+        {
+            const sal_uInt16 nCount = nTokenCount - 1;
+            aPoly.SetSize(nCount);
 
-        for ( sal_uInt16 i = 0; i < nCount; i++ )
-            aPoly[ i ] = ImpReadNCSACoords( &pStr );
+            for (sal_uInt16 i = 0; i < nCount; ++i)
+                aPoly[ i ] = ImpReadNCSACoords( &pStr );
+        }
 
         maList.emplace_back( new IMapPolygonObject( aPoly, aURL, OUString(), 
OUString(), OUString(), OUString() ) );
     }

Reply via email to