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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Mon May 3 12:04:19 UTC 2021


 sc/source/filter/oox/sheetdatabuffer.cxx |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

New commits:
commit b912eafa33227a5622c5a4310948cfa07c984726
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon May 3 10:58:14 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon May 3 14:03:35 2021 +0200

    fix use-after-free
    
    after
        commit deac5c84732c3491a0ef5bf7f8c1552e6def4fc0
        tdf#79049 speed up OOXML workbook load (2)
    when updating the iterator, I forgot to update the variable
    we are using to point into the vector.
    Rather just use the iterator to access the element.
    
    Change-Id: Iac8b6b7cdd945b2ccd261b0edc2ea8a563a10b1b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115028
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/source/filter/oox/sheetdatabuffer.cxx b/sc/source/filter/oox/sheetdatabuffer.cxx
index c9c688c2ca17..e497ee44f8d8 100644
--- a/sc/source/filter/oox/sheetdatabuffer.cxx
+++ b/sc/source/filter/oox/sheetdatabuffer.cxx
@@ -416,25 +416,23 @@ void SheetDataBuffer::addColXfStyleProcessRowRanges()
                 bool bAddRange = true;
                 for ( ; rows_it != rRowStyles.end(); ++rows_it )
                 {
-                    const RowRangeStyle& r = *rows_it;
-
                     // Add the part of aStyleRows that does not overlap with r
-                    if ( aStyleRows.mnStartRow < r.mnStartRow )
+                    if ( aStyleRows.mnStartRow < rows_it->mnStartRow )
                     {
                         RowRangeStyle aSplit = aStyleRows;
-                        aSplit.mnEndRow = std::min(aStyleRows.mnEndRow, r.mnStartRow - 1);
+                        aSplit.mnEndRow = std::min(aStyleRows.mnEndRow, rows_it->mnStartRow - 1);
                         rows_it = rRowStyles.insert( aSplit ).first;
                     }
 
                     // Done if no part of aStyleRows extends beyond r
-                    if ( aStyleRows.mnEndRow <= r.mnEndRow )
+                    if ( aStyleRows.mnEndRow <= rows_it->mnEndRow )
                     {
                         bAddRange = false;
                         break;
                     }
 
                     // Cut off the part aStyleRows that was handled above
-                    aStyleRows.mnStartRow = r.mnEndRow + 1;
+                    aStyleRows.mnStartRow = rows_it->mnEndRow + 1;
                 }
                 if ( bAddRange )
                     rRowStyles.insert( aStyleRows );


More information about the Libreoffice-commits mailing list