diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-05-03 10:58:14 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-05-03 14:03:35 +0200 |
commit | b912eafa33227a5622c5a4310948cfa07c984726 (patch) | |
tree | cdbdc2bf1340e90f538b2dd3d147fe101dd4eb1c | |
parent | 040451e19087d8cb8ff4376166ca8248f909a4e0 (diff) |
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@collabora.co.uk>
-rw-r--r-- | sc/source/filter/oox/sheetdatabuffer.cxx | 10 |
1 files changed, 4 insertions, 6 deletions
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 ); |