sc/source/filter/html/htmlpars.cxx | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-)
New commits: commit 0c11979e2bccd3723a292fe83bef1f10aebde16c Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Sat Mar 23 15:40:26 2024 +0000 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Thu May 30 11:22:23 2024 +0200 ofz#67540 negative offset Change-Id: I498985962feb7d77c1a71af7002a85aa02aa3e65 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165232 Reviewed-by: Miklos Vajna <vmik...@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index ebccbf860f49..6b154ddbc4fd 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -740,19 +740,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; } } }