diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-03-24 09:37:25 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-03-24 20:42:45 +0100 |
commit | 5e8a5ce17a8b22d04db713c28721593f2e3d0382 (patch) | |
tree | 40e05a6901e365b12a5f8be8680e8b948c1eeb84 /sc | |
parent | 1bc297cb63e52b5cad3580ac5a3cb274c6dfcf66 (diff) |
cid#1242836 rearrange to clear Untrusted value as argument
and...
cid#1242942 Untrusted value as argument
cid#1474015 Untrusted value as argument
cid#1474196 Untrusted value as argument
Change-Id: I3952844908a0d98f04e21bb50c11c53fabcd23a7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113029
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/filter/lotus/op.cxx | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/sc/source/filter/lotus/op.cxx b/sc/source/filter/lotus/op.cxx index 040cf761600c..e8be41505c25 100644 --- a/sc/source/filter/lotus/op.cxx +++ b/sc/source/filter/lotus/op.cxx @@ -73,10 +73,11 @@ void OP_Integer(LotusContext& rContext, SvStream& r, sal_uInt16 /*n*/) SCCOL nCol(static_cast<SCCOL>(nTmpCol)); SCROW nRow(static_cast<SCROW>(nTmpRow)); - if (rContext.rDoc.ValidColRow(nCol, nRow)) + ScAddress aAddr(nCol, nRow, 0); + if (rContext.rDoc.ValidAddress(aAddr)) { rContext.rDoc.EnsureTable(0); - rContext.rDoc.SetValue(ScAddress(nCol, nRow, 0), static_cast<double>(nValue)); + rContext.rDoc.SetValue(aAddr, static_cast<double>(nValue)); // 0 digits in fractional part! SetFormat(rContext, nCol, nRow, 0, nFormat, 0); @@ -92,11 +93,12 @@ void OP_Number(LotusContext& rContext, SvStream& r, sal_uInt16 /*n*/) SCCOL nCol(static_cast<SCCOL>(nTmpCol)); SCROW nRow(static_cast<SCROW>(nTmpRow)); - if (rContext.rDoc.ValidColRow(nCol, nRow)) + ScAddress aAddr(nCol, nRow, 0); + if (rContext.rDoc.ValidAddress(aAddr)) { fValue = ::rtl::math::round( fValue, 15 ); rContext.rDoc.EnsureTable(0); - rContext.rDoc.SetValue(ScAddress(nCol, nRow, 0), fValue); + rContext.rDoc.SetValue(aAddr, fValue); SetFormat(rContext, nCol, nRow, 0, nFormat, nFractionalFloat); } @@ -379,11 +381,12 @@ void OP_Number123(LotusContext& rContext, SvStream& r, sal_uInt16 /*n*/) SCCOL nCol(static_cast<SCCOL>(nTmpCol)); SCROW nRow(static_cast<SCROW>(nTmpRow)); - if (rContext.rDoc.ValidColRow(nCol, nRow) && nTab <= rContext.rDoc.GetMaxTableNumber()) + ScAddress aAddr(nCol, nRow, nTab); + if (rContext.rDoc.ValidAddress(aAddr) && nTab <= rContext.rDoc.GetMaxTableNumber()) { double fValue = Snum32ToDouble( nValue ); rContext.rDoc.EnsureTable(nTab); - rContext.rDoc.SetValue(ScAddress(nCol,nRow,nTab), fValue); + rContext.rDoc.SetValue(aAddr, fValue); } } @@ -399,7 +402,7 @@ void OP_Formula123(LotusContext& rContext, SvStream& r, sal_uInt16 n) std::unique_ptr<ScTokenArray> pResult; sal_Int32 nBytesLeft = (n > 12) ? n - 12 : 0; - ScAddress aAddress( nCol, nRow, nTab ); + ScAddress aAddress(nCol, nRow, nTab); svl::SharedStringPool& rSPool = rContext.rDoc.GetSharedStringPool(); LotusToSc aConv(rContext, r, rSPool, rContext.eCharset, true); @@ -408,12 +411,12 @@ void OP_Formula123(LotusContext& rContext, SvStream& r, sal_uInt16 n) if (!aConv.good()) return; - if (rContext.rDoc.ValidColRow(nCol, nRow) && nTab <= rContext.rDoc.GetMaxTableNumber()) + if (rContext.rDoc.ValidAddress(aAddress) && nTab <= rContext.rDoc.GetMaxTableNumber()) { ScFormulaCell* pCell = new ScFormulaCell(rContext.rDoc, aAddress, std::move(pResult)); pCell->AddRecalcMode( ScRecalcMode::ONLOAD_ONCE ); rContext.rDoc.EnsureTable(nTab); - rContext.rDoc.SetFormulaCell(ScAddress(nCol,nRow,nTab), pCell); + rContext.rDoc.SetFormulaCell(aAddress, pCell); } } @@ -427,10 +430,11 @@ void OP_IEEENumber123(LotusContext& rContext, SvStream& r, sal_uInt16 /*n*/) SCCOL nCol(static_cast<SCCOL>(nTmpCol)); SCROW nRow(static_cast<SCROW>(nTmpRow)); - if (rContext.rDoc.ValidColRow(nCol, nRow) && nTab <= rContext.rDoc.GetMaxTableNumber()) + ScAddress aAddr(nCol, nRow, nTab); + if (rContext.rDoc.ValidAddress(aAddr) && nTab <= rContext.rDoc.GetMaxTableNumber()) { rContext.rDoc.EnsureTable(nTab); - rContext.rDoc.SetValue(ScAddress(nCol,nRow,nTab), dValue); + rContext.rDoc.SetValue(aAddr, dValue); } } |