diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-03-18 20:47:02 +0000 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2024-06-27 18:23:10 +0200 |
commit | 074b6510b9072e0e20b06b29f57803697b2c8ed1 (patch) | |
tree | c582e205125491e598a37c64cf608e5827833817 /sc/source/filter | |
parent | dc7bd075d076deb5cec53b1f1c4264b07a2ec065 (diff) |
AddressSanitizer: container-overflow in initial sc html fuzzing
Change-Id: I20d7baa6fd6fcb9c7d0019d7891a237dd721ef31
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164980
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
(cherry picked from commit 4645391b56c32d59f241e66798f72183ad29ad13)
Diffstat (limited to 'sc/source/filter')
-rw-r--r-- | sc/source/filter/html/htmlpars.cxx | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index 063408b18e31..f8686de51eec 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -637,12 +637,17 @@ void ScHTMLLayoutParser::SetWidths() MakeColNoRef( pLocalColOffset, nOff, 0, 0, 0 ); } nTableWidth = static_cast<sal_uInt16>(pLocalColOffset->back() - pLocalColOffset->front()); + const auto nColsAvailable = pLocalColOffset->size(); for ( size_t i = nFirstTableCell, nListSize = maList.size(); i < nListSize; ++i ) { auto& pE = maList[ i ]; if ( pE->nTab == nTable ) { - pE->nOffset = static_cast<sal_uInt16>((*pLocalColOffset)[pE->nCol - nColCntStart]); + const size_t nColRequested = pE->nCol - nColCntStart; + if (nColRequested < nColsAvailable) + pE->nOffset = static_cast<sal_uInt16>((*pLocalColOffset)[nColRequested]); + else + SAL_WARN("sc", "missing information for column: " << nColRequested); pE->nWidth = 0; // to be recalculated later } } |