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

New commits:
commit ec0af04c4b5c2e622a5fc851285558ce72081254
Author:     Andras Timar <[email protected]>
AuthorDate: Thu Feb 26 16:03:39 2026 +0100
Commit:     Miklos Vajna <[email protected]>
CommitDate: Fri Feb 27 10:00:22 2026 +0100

    Fix SIGSEGV in InvalidateByForeignEditView with stale tab data
    
    When FetchTableData() returns nullptr during collaborative editing
    (e.g. concurrent sheet deletion), GetCurXForTab/GetCurYForTab return
    -1. These invalid coordinates propagate to GetPattern() which returns
    nullptr, causing a null pointer dereference in SfxItemSet::Get().
    
    Validate the coordinates before passing them to GetEditArea().
    
    Change-Id: I084ab156140d60ee95772ca0c5690028ecdaca44
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200447
    Reviewed-by: Miklos Vajna <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 4c8cc0202d08..b900ae9256b8 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1765,6 +1765,9 @@ bool ScGridWindow::InvalidateByForeignEditView(EditView* 
pEditView)
     tools::Long nX = rViewData.GetCurXForTab(nRefTabNo);
     tools::Long nY = rViewData.GetCurYForTab(nRefTabNo);
 
+    if (nX < 0 || nY < 0)
+        return false;
+
     tools::Rectangle aPixRect = getViewData().GetEditArea(eWhich, nX, nY, 
this, nullptr, true);
     tools::Rectangle aLogicRect = PixelToLogic(aPixRect, 
getViewData().GetLogicMode());
     Invalidate(pEditView->IsNegativeX() ? lcl_negateRectX(aLogicRect) : 
aLogicRect);

Reply via email to