[Libreoffice-commits] core.git: sc/source

Eike Rathke erack at redhat.com
Fri Apr 7 14:23:45 UTC 2017


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

New commits:
commit 0c55972d747511dbc711f3c9cbb4db5d8c5dc2ff
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

diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx
index d5b8c904a726..64638a63e048 100644
--- a/sc/source/ui/view/tabvwshf.cxx
+++ b/sc/source/ui/view/tabvwshf.cxx
@@ -659,13 +659,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