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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Jul 13 17:54:25 UTC 2018


 sc/inc/columniterator.hxx              |    1 +
 sc/source/core/data/columniterator.cxx |   10 +++++++---
 2 files changed, 8 insertions(+), 3 deletions(-)

New commits:
commit 4a8ecfd9fdb6d8460bc7eee8773580d4ae550b18
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Thu Jul 12 19:06:03 2018 +0100
Commit:     Eike Rathke <erack at redhat.com>
CommitDate: Fri Jul 13 19:53:57 2018 +0200

    tdf#118620 - avoid out of bounds iterator for end of sheet pivots.
    
    Change-Id: I2ddcf56dc94175718739611f0791558fda87b1ba
    Reviewed-on: https://gerrit.libreoffice.org/57358
    Tested-by: Jenkins
    Reviewed-by: Kohei Yoshida <libreoffice at kohei.us>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    (cherry picked from commit d3387b38fe0eea3fb7ac630c026f02986e8dafc4)
    Reviewed-on: https://gerrit.libreoffice.org/57385
    Reviewed-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/inc/columniterator.hxx b/sc/inc/columniterator.hxx
index c6a87b4e6b39..799d437b33e0 100644
--- a/sc/inc/columniterator.hxx
+++ b/sc/inc/columniterator.hxx
@@ -60,6 +60,7 @@ class ColumnIterator
 {
     CellStoreType::const_position_type maPos;
     CellStoreType::const_position_type maPosEnd;
+    bool mbComplete;
 
 public:
     ColumnIterator( const CellStoreType& rCells, SCROW nRow1, SCROW nRow2 );
diff --git a/sc/source/core/data/columniterator.cxx b/sc/source/core/data/columniterator.cxx
index f7367193d9cb..ad96639ca9d4 100644
--- a/sc/source/core/data/columniterator.cxx
+++ b/sc/source/core/data/columniterator.cxx
@@ -172,7 +172,8 @@ namespace sc {
 
 ColumnIterator::ColumnIterator( const CellStoreType& rCells, SCROW nRow1, SCROW nRow2 ) :
     maPos(rCells.position(nRow1)),
-    maPosEnd(rCells.position(maPos.first, nRow2+1))
+    maPosEnd(rCells.position(maPos.first, nRow2)),
+    mbComplete(false)
 {
 }
 
@@ -180,7 +181,10 @@ ColumnIterator::~ColumnIterator() {}
 
 void ColumnIterator::next()
 {
-    maPos = CellStoreType::next_position(maPos);
+    if ( maPos == maPosEnd)
+        mbComplete = true;
+    else
+        maPos = CellStoreType::next_position(maPos);
 }
 
 SCROW ColumnIterator::getRow() const
@@ -190,7 +194,7 @@ SCROW ColumnIterator::getRow() const
 
 bool ColumnIterator::hasCell() const
 {
-    return maPos != maPosEnd;
+    return !mbComplete;
 }
 
 mdds::mtv::element_t ColumnIterator::getType() const


More information about the Libreoffice-commits mailing list