sc/source/core/data/column3.cxx |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 36ba1f15ec7c89070cee81fc6188cc792300fdf4
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Tue Oct 8 19:28:03 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed Oct 9 17:30:28 2024 +0200

    cid#1607047 Overflowed integer argument
    
    Change-Id: Ic1b625dec3768fe5a5415b667bef3c32b0c13e8d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174709
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 1b4ccafa5d54..25f943f68955 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -579,9 +579,11 @@ void ScColumn::AttachFormulaCells( 
sc::StartListeningContext& rCxt, SCROW nRow1,
         if (rCell.IsShared())
         {
             nRow1 = std::min( nRow1, rCell.GetSharedTopRow());
-            if (nRow2 < rCell.GetSharedTopRow() + rCell.GetSharedLength())
+            SCROW nCellLen = rCell.GetSharedLength();
+            assert(nCellLen > 0);
+            if (nRow2 < rCell.GetSharedTopRow() + nCellLen)
             {
-                nRow2 = rCell.GetSharedTopRow() + rCell.GetSharedLength() - 1;
+                nRow2 = rCell.GetSharedTopRow() + nCellLen - 1;
                 bEnlargedDown = true;
                 // Same end row is also enlarged, i.e. doesn't need to be
                 // checked for another group.

Reply via email to