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

Eike Rathke erack at redhat.com
Tue Apr 11 10:46:06 UTC 2017


 sc/source/ui/view/tabvwshf.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 9826eb9b6bad6f21801dd8a0016bb770085a9072
Author: Eike Rathke <erack at redhat.com>
Date:   Fri Apr 7 16:20:37 2017 +0200

    out-of-bounds tab access when deleting second last sheet
    
    Which in a debug build lead to STL assert
    Error: attempt to subscript container with out-of-bounds index
    
    Change-Id: I09fddbc9e4b214b0313c193f85830ed458d20c0e
    (cherry picked from commit 0c55972d747511dbc711f3c9cbb4db5d8c5dc2ff)
    Reviewed-on: https://gerrit.libreoffice.org/36274
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx
index a62c76e2d6e3..35d89eb15acb 100644
--- a/sc/source/ui/view/tabvwshf.cxx
+++ b/sc/source/ui/view/tabvwshf.cxx
@@ -624,13 +624,13 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
                             {
                                 TheTabs.push_back(i);
                                 bTabFlag = true;
-                                if (nNewTab == i)
+                                if (nNewTab == i && i+1 < nTabCount)
                                     nNewTab++;
                             }
                             if (!bTabFlag)
                                 nFirstTab = i;
                         }
-                        if (nNewTab >= nTabCount)
+                        if (nNewTab >= nTabCount - static_cast<SCTAB>(TheTabs.size()))
                             nNewTab = nFirstTab;
                     }
 


More information about the Libreoffice-commits mailing list