sc/source/filter/html/htmlpars.cxx | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-)
New commits: commit f791b56325c8eac4ad321a3b927c9eb3f02baab0 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Sat Mar 23 15:40:26 2024 +0000 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Sun Mar 24 18:55:41 2024 +0100 ofz#67540 negative offset Change-Id: I498985962feb7d77c1a71af7002a85aa02aa3e65 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165230 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Andras Timar <andras.ti...@collabora.com> diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index 830dac6f6615..9f15f1131b13 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -836,19 +836,22 @@ void ScHTMLLayoutParser::SetWidths() for ( size_t i = nFirstTableCell, nListSize = maList.size(); i < nListSize; ++i ) { auto& pE = maList[ i ]; - if ( pE->nTab == nTable ) + if (pE->nTab != nTable) + continue; + nCol = pE->nCol - nColCntStart; + OSL_ENSURE( nCol < nColsPerRow, "ScHTMLLayoutParser::SetWidths: column overflow" ); + if (nCol >= nColsPerRow) + continue; + pE->nOffset = pOffsets[nCol]; + nCol = nCol + pE->nColOverlap; + if ( nCol > nColsPerRow ) + nCol = nColsPerRow; + if (nCol < 0) { - nCol = pE->nCol - nColCntStart; - OSL_ENSURE( nCol < nColsPerRow, "ScHTMLLayoutParser::SetWidths: column overflow" ); - if ( nCol < nColsPerRow ) - { - pE->nOffset = pOffsets[nCol]; - nCol = nCol + pE->nColOverlap; - if ( nCol > nColsPerRow ) - nCol = nColsPerRow; - pE->nWidth = pOffsets[nCol] - pE->nOffset; - } + SAL_WARN("sc", "negative offset: " << nCol); + continue; } + pE->nWidth = pOffsets[nCol] - pE->nOffset; } } }