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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Feb 28 15:53:31 UTC 2019


 sc/source/core/data/column2.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit beba45a5639bc32ca6893885ca3b1f07e3175c08
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Mon Feb 25 14:37:48 2019 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Thu Feb 28 16:53:06 2019 +0100

    avoid std::out_of_range thrown by mdds (tdf#122643)
    
    Calling GetLastDataRow/Pos() with MAXROW as the last row is apparently
    fine, but if that's an invalid row, but anything beyond that is not ok.
    ScDependantsCalculator::trimLength() may use such larger "last" row
    value because it works on a range of cells.
    
    Change-Id: I819a4d20a4765e23af6208df5f2e208ac44b694c
    Reviewed-on: https://gerrit.libreoffice.org/68349
    Tested-by: Jenkins
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Reviewed-by: Kohei Yoshida <libreoffice at kohei.us>

diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index b937bfaa1ded..7639ca7ddc26 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -1299,7 +1299,7 @@ SCROW ScColumn::GetLastDataPos() const
 SCROW ScColumn::GetLastDataPos( SCROW nLastRow, bool bConsiderCellNotes,
                                 bool bConsiderCellDrawObjects ) const
 {
-    sc::CellStoreType::const_position_type aPos = maCells.position(nLastRow);
+    sc::CellStoreType::const_position_type aPos = maCells.position(std::min(nLastRow,MAXROW));
 
     if (bConsiderCellNotes && !IsNotesEmptyBlock(nLastRow, nLastRow))
         return nLastRow;


More information about the Libreoffice-commits mailing list