summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-06-11 11:06:11 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-06-11 14:42:38 +0200
commit8ce77cbd706ffd60dfcd79d82779025ef8d6782c (patch)
treeff8f83b9a89258316f8b959938c6a1547c74b411
parent3914dd55c45bef6b0dbfd7c6eba1f0b4b43743ba (diff)
cid#1473844 Untrusted loop bound
and cid#1474351 Untrusted loop bound cid#1474118 Untrusted loop bound this time without second guessing the original intent Change-Id: Iaa6b636a08ed29feaf709fbcbac7deac761a0fc7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117045 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sc/source/filter/excel/impop.cxx18
1 files changed, 16 insertions, 2 deletions
diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx
index 1c107d4ad092..988ec3fbf65e 100644
--- a/sc/source/filter/excel/impop.cxx
+++ b/sc/source/filter/excel/impop.cxx
@@ -878,8 +878,14 @@ void ImportExcel::Mulrk()
XclAddress aXclPos;
aIn >> aXclPos;
- for( XclAddress aCurrXclPos( aXclPos ); (aXclPos.mnCol <= aCurrXclPos.mnCol) && (aIn.GetRecLeft() > 2); ++aCurrXclPos.mnCol )
+ XclAddress aCurrXclPos(aXclPos);
+ while (true)
{
+ if (aXclPos.mnCol > aCurrXclPos.mnCol)
+ break;
+ if (aIn.GetRecLeft() <= 2)
+ break;
+
sal_uInt16 nXF = aIn.ReaduInt16();
sal_Int32 nRkNum = aIn.ReadInt32();
@@ -889,6 +895,7 @@ void ImportExcel::Mulrk()
GetXFRangeBuffer().SetXF( aScPos, nXF );
GetDocImport().setNumericCell(aScPos, XclTools::GetDoubleFromRK(nRkNum));
}
+ ++aCurrXclPos.mnCol;
}
}
@@ -915,13 +922,20 @@ void ImportExcel::Mulblank()
XclAddress aXclPos;
aIn >> aXclPos;
- for( XclAddress aCurrXclPos( aXclPos ); (aXclPos.mnCol <= aCurrXclPos.mnCol) && (aIn.GetRecLeft() > 2); ++aCurrXclPos.mnCol )
+ XclAddress aCurrXclPos(aXclPos);
+ while (true)
{
+ if (aXclPos.mnCol > aCurrXclPos.mnCol)
+ break;
+ if (aIn.GetRecLeft() <= 2)
+ break;
+
sal_uInt16 nXF = aIn.ReaduInt16();
ScAddress aScPos( ScAddress::UNINITIALIZED );
if( GetAddressConverter().ConvertAddress( aScPos, aCurrXclPos, GetCurrScTab(), true ) )
GetXFRangeBuffer().SetBlankXF( aScPos, nXF );
+ ++aCurrXclPos.mnCol;
}
}