[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3-desktop' - sc/source

Eike Rathke erack at redhat.com
Thu Jun 21 18:34:00 UTC 2018


 sc/source/ui/view/viewdata.cxx |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

New commits:
commit a7b45b225a2ff3deb3b28ff938a67493e0631b90
Author: Eike Rathke <erack at redhat.com>
Date:   Wed Jun 21 17:42:42 2017 +0200

    Resolves: tdf#108654 check nTabNo against maTabData size
    
    ScViewData::DeleteTab() and DeleteTabs() never did that and worked by accident
    for which commit 73dec49802ef8fc42c5719efaa42a33cde68e569 removed the
    grounding..
    
    squash this into it too:
    
    assert(nTab < static_cast<SCTAB>(maTabData.size())); cause of tdf#108796
    
    Have a dev friendly abort instead of a deep throw in case of the unexpected.
    
    Change-Id: I95460cd017d558c073df7891551d0251009dc1d4
    Reviewed-on: https://gerrit.libreoffice.org/56261
    Reviewed-by: Aron Budea <aron.budea at collabora.com>
    Tested-by: Aron Budea <aron.budea at collabora.com>
    (cherry picked from commit abe9a9b023d1b08384f2f529e442e9a59de10f8c)

diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 85ffdce151c6..e93abac8e66b 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -705,9 +705,15 @@ void ScViewData::InsertTabs( SCTAB nTab, SCTAB nNewSheets )
 
 void ScViewData::DeleteTab( SCTAB nTab )
 {
+    assert(nTab < static_cast<SCTAB>(maTabData.size()));
     delete maTabData.at(nTab);
-
     maTabData.erase(maTabData.begin() + nTab);
+
+    if (static_cast<size_t>(nTabNo) >= maTabData.size())
+    {
+        EnsureTabDataSize(1);
+        nTabNo = maTabData.size() - 1;
+    }
     UpdateCurrentTab();
     mpMarkData->DeleteTab( nTab );
 }
@@ -721,6 +727,11 @@ void ScViewData::DeleteTabs( SCTAB nTab, SCTAB nSheets )
     }
 
     maTabData.erase(maTabData.begin() + nTab, maTabData.begin()+ nTab+nSheets);
+    if (static_cast<size_t>(nTabNo) >= maTabData.size())
+    {
+        EnsureTabDataSize(1);
+        nTabNo = maTabData.size() - 1;
+    }
     UpdateCurrentTab();
 }
 


More information about the Libreoffice-commits mailing list