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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Jul 18 08:36:54 UTC 2018


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

New commits:
commit dcbeed737800f37457ee4d80fda1895fd2a0ef57
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Thu Jul 12 19:06:03 2018 +0100
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Wed Jul 18 10:36:32 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/57386
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.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