diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-03-23 15:40:26 +0000 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2024-04-03 14:38:43 +0200 |
commit | a47e278f36579926f341657db1d846416de61ba4 (patch) | |
tree | 60ac159df0bf923158e3aa26f881378f8305353c | |
parent | ef8d0a60de31fb0346ace1c682995bce0a7301d3 (diff) |
ofz#67540 negative offset
Change-Id: I498985962feb7d77c1a71af7002a85aa02aa3e65
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165189
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
(cherry picked from commit d2210a5b418e7cbdef9a0de0fe3d9fd91115eb49)
-rw-r--r-- | sc/source/filter/html/htmlpars.cxx | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index 34f481eba09c..8abe9a4e95d9 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -731,19 +731,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; } } } |