[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - sc/source

Arul arul71.m at gmail.com
Tue Jan 12 03:38:57 PST 2016


 sc/source/core/data/column.cxx |   21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

New commits:
commit 293e7bef122fc5f5f4b9cc7719e22489913e8726
Author: Arul <arul71.m at gmail.com>
Date:   Tue Jan 12 15:35:14 2016 +0530

    tdf#90606 Crash when delete a large part of a column with shift cells left
    
    skipping splitFormulaCellGroup() and joinFormulaCellAbove() for nEndRow equal
    to MAXROW since nEndRow + 1 is not valid
    
    Change-Id: Iabfcb33bf58d20331841ca386cca4a91fd6598bf
    Reviewed-on: https://gerrit.libreoffice.org/21389
    Reviewed-by: jan iversen <jani at documentfoundation.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>
    (cherry picked from commit 975ceab198a06558875006bbd9a4d0a2708e416e)
    Reviewed-on: https://gerrit.libreoffice.org/21393

diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 910981a..3a7daf1 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -1909,14 +1909,20 @@ void ScColumn::MoveTo(SCROW nStartRow, SCROW nEndRow, ScColumn& rCol)
     // Split the formula grouping at the top and bottom boundaries.
     sc::CellStoreType::position_type aPos = maCells.position(nStartRow);
     sc::SharedFormulaUtil::splitFormulaCellGroup(aPos, nullptr);
-    aPos = maCells.position(aPos.first, nEndRow+1);
-    sc::SharedFormulaUtil::splitFormulaCellGroup(aPos, nullptr);
+    if (ValidRow(nEndRow+1))
+    {
+        aPos = maCells.position(aPos.first, nEndRow+1);
+        sc::SharedFormulaUtil::splitFormulaCellGroup(aPos, nullptr);
+    }
 
     // Do the same with the destination column.
     aPos = rCol.maCells.position(nStartRow);
     sc::SharedFormulaUtil::splitFormulaCellGroup(aPos, nullptr);
-    aPos = rCol.maCells.position(aPos.first, nEndRow+1);
-    sc::SharedFormulaUtil::splitFormulaCellGroup(aPos, nullptr);
+    if (ValidRow(nEndRow+1))
+    {
+        aPos = rCol.maCells.position(aPos.first, nEndRow+1);
+        sc::SharedFormulaUtil::splitFormulaCellGroup(aPos, nullptr);
+    }
 
     // Move the broadcasters to the destination column.
     maBroadcasters.transfer(nStartRow, nEndRow, rCol.maBroadcasters, nStartRow);
@@ -1930,8 +1936,11 @@ void ScColumn::MoveTo(SCROW nStartRow, SCROW nEndRow, ScColumn& rCol)
     // Re-group transferred formula cells.
     aPos = rCol.maCells.position(nStartRow);
     sc::SharedFormulaUtil::joinFormulaCellAbove(aPos);
-    aPos = rCol.maCells.position(aPos.first, nEndRow+1);
-    sc::SharedFormulaUtil::joinFormulaCellAbove(aPos);
+    if (ValidRow(nEndRow+1))
+    {
+        aPos = rCol.maCells.position(aPos.first, nEndRow+1);
+        sc::SharedFormulaUtil::joinFormulaCellAbove(aPos);
+    }
 
     CellStorageModified();
     rCol.CellStorageModified();


More information about the Libreoffice-commits mailing list