ofz#67906 Integer-overflow

Change-Id: I459bdeef6bb7577c5388202374c981c7b01fa137
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165899
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
This commit is contained in:
Caolán McNamara 2024-04-08 22:07:11 +01:00
parent 8527dc74eb
commit 11e98a5087

View File

@ -1058,7 +1058,7 @@ void ScHTMLLayoutParser::TableDataOn( HtmlImportInfo* pInfo )
case HtmlOptionId::COLSPAN:
{
sal_Int32 nColOverlap = rOption.GetString().toInt32();
if (nColOverlap >= 0 && nColOverlap <= SCCOL_MAX)
if (nColOverlap >= 0 && nColOverlap <= mpDoc->MaxCol())
mxActEntry->nColOverlap = static_cast<SCCOL>(nColOverlap);
else
SAL_WARN("sc", "ScHTMLLayoutParser::TableDataOn ignoring colspan: " << nColOverlap);
@ -1067,7 +1067,7 @@ void ScHTMLLayoutParser::TableDataOn( HtmlImportInfo* pInfo )
case HtmlOptionId::ROWSPAN:
{
sal_Int32 nRowOverlap = rOption.GetString().toInt32();
if (nRowOverlap >= 0)
if (nRowOverlap >= 0 && nRowOverlap <= mpDoc->MaxRow())
mxActEntry->nRowOverlap = static_cast<SCROW>(nRowOverlap);
else
SAL_WARN("sc", "ScHTMLLayoutParser::TableDataOn ignoring rowspan: " << nRowOverlap);