sc/source/ui/view/gridwin4.cxx |    6 ++++++
 1 file changed, 6 insertions(+)

New commits:
commit d0e2b97186925a687989d3a8c546d6dba98dc7ae
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Wed Feb 28 12:04:28 2024 +0000
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Wed Feb 28 16:18:52 2024 +0100

    assertion fails on last rows selection / modification
    
    Open Calc hello world spreadsheet
    Click on cell in column H
    Press ctrl + shift + down arrow to select and go to the end of sheet (cell 
H1048576)
    Click on the H1048576 and type something, Save
    Refresh browser / reload spreadsheet
    try to select modified cell, remove content
    
    Result: Crash
    
    assert(nEndRow >= nStartRow);
    nEndRow   = 1048575
    nStartRow = 1048576
    
    likely an assert since:
    
    commit a86c00414a43c5d87981ffae1018cb242c5e5e1d
    Date:   Fri Jan 19 14:27:10 2024 +0200
    
        cool#6893 reduce allocation in ScGridWindow::PaintTile
    
    but seems harmless for this specific example
    
    Change-Id: I1d492c357a7a0a23b9f9cc974c4b9f684aba8648
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163987
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 9c93e137750c..bea61ba0bc7b 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1544,9 +1544,15 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice,
     nBottomRightTileCol++;
     nBottomRightTileRow++;
 
+    if (nTopLeftTileCol > rDoc.MaxCol())
+        nTopLeftTileCol = rDoc.MaxCol();
+
     if (nBottomRightTileCol > rDoc.MaxCol())
         nBottomRightTileCol = rDoc.MaxCol();
 
+    if (nTopLeftTileRow > MAXTILEDROW)
+        nTopLeftTileRow = MAXTILEDROW;
+
     if (nBottomRightTileRow > MAXTILEDROW)
         nBottomRightTileRow = MAXTILEDROW;
 

Reply via email to