summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-06-11 10:43:24 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-06-11 13:48:22 +0200
commitb1d19950d3f89460109dfc0e3720ac22d4307ff8 (patch)
tree28bf86d51a946a0295c6f18dab4c8cbc000114a7 /sc
parent4fbc246c7021248e4e9689f59b030b4b8f526954 (diff)
Resolves: tdf#142758 Revert record parse misunderstanding
of 'Related: cid#1474351 Untrusted loop bound' and add in documentation for the records This reverts commit 2134d83b8d6e73ca8eacd812eb3431bff38c74f6. This reverts commit 7c2e6058439da9d061e5e0bbd07c8b6d4f2ffcbf. This reverts commit 3748fe3e4fc22a400b3120010192b75754e38b17. Change-Id: I5b407eb4388a8d67fc863cc6070fbbf8b15321d9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117044 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/filter/excel/impop.cxx51
1 files changed, 37 insertions, 14 deletions
diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx
index 7df9e0567323..1c107d4ad092 100644
--- a/sc/source/filter/excel/impop.cxx
+++ b/sc/source/filter/excel/impop.cxx
@@ -858,16 +858,28 @@ void ImportExcel::Shrfmla()
void ImportExcel::Mulrk()
{
+ /* rw (2 bytes): An Rw structure that specifies the row containing the
+ cells with numeric data.
+
+ colFirst (2 bytes): A Col structure that specifies the first column in
+ the series of numeric cells within the sheet. The value of colFirst.col
+ MUST be less than or equal to 254.
+
+ rgrkrec (variable): An array of RkRec structures. Each element in the
+ array specifies an RkRec in the row. The number of entries in the array
+ MUST be equal to the value given by the following formula:
+
+ Number of entries in rgrkrec = (colLast.col – colFirst.col +1)
+
+ colLast (2 bytes): A Col structure that specifies the last column in
+ the set of numeric cells within the sheet. This colLast.col value MUST
+ be greater than the colFirst.col value. */
+
XclAddress aXclPos;
aIn >> aXclPos;
- XclAddress aCurrXclPos(aXclPos);
- while (true)
+ for( XclAddress aCurrXclPos( aXclPos ); (aXclPos.mnCol <= aCurrXclPos.mnCol) && (aIn.GetRecLeft() > 2); ++aCurrXclPos.mnCol )
{
- if (aIn.GetRecLeft() < 6)
- break;
- if (aCurrXclPos.mnCol < aXclPos.mnCol)
- break;
sal_uInt16 nXF = aIn.ReaduInt16();
sal_Int32 nRkNum = aIn.ReadInt32();
@@ -877,28 +889,39 @@ void ImportExcel::Mulrk()
GetXFRangeBuffer().SetXF( aScPos, nXF );
GetDocImport().setNumericCell(aScPos, XclTools::GetDoubleFromRK(nRkNum));
}
- ++aCurrXclPos.mnCol;
}
}
void ImportExcel::Mulblank()
{
+ /* rw (2 bytes): An Rw structure that specifies a row containing the blank
+ cells.
+
+ colFirst (2 bytes): A Col structure that specifies the first column in
+ the series of blank cells within the sheet. The value of colFirst.col
+ MUST be less than or equal to 254.
+
+ rgixfe (variable): An array of IXFCell structures. Each element of this
+ array contains an IXFCell structure corresponding to a blank cell in the
+ series. The number of entries in the array MUST be equal to the value
+ given by the following formula:
+
+ Number of entries in rgixfe = (colLast.col – colFirst.col +1)
+
+ colLast (2 bytes): A Col structure that specifies the last column in
+ the series of blank cells within the sheet. This colLast.col value MUST
+ be greater than colFirst.col value. */
+
XclAddress aXclPos;
aIn >> aXclPos;
- XclAddress aCurrXclPos(aXclPos);
- while (true)
+ for( XclAddress aCurrXclPos( aXclPos ); (aXclPos.mnCol <= aCurrXclPos.mnCol) && (aIn.GetRecLeft() > 2); ++aCurrXclPos.mnCol )
{
- if (aIn.GetRecLeft() < 2)
- break;
- if (aCurrXclPos.mnCol < aXclPos.mnCol)
- break;
sal_uInt16 nXF = aIn.ReaduInt16();
ScAddress aScPos( ScAddress::UNINITIALIZED );
if( GetAddressConverter().ConvertAddress( aScPos, aCurrXclPos, GetCurrScTab(), true ) )
GetXFRangeBuffer().SetBlankXF( aScPos, nXF );
- ++aCurrXclPos.mnCol;
}
}