diff options
author | Eike Rathke <erack@redhat.com> | 2016-03-07 19:03:16 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2016-03-07 19:10:30 +0100 |
commit | 72d710ca5a323b66a77c78f24e7017b1330cca63 (patch) | |
tree | 055256be55adeac762907a2a13804d4288c7ef6d /sc | |
parent | af46264bccbc16bf1edf9c5cbe944a4b883a1353 (diff) |
use ScMatrix::IsSizeAllocatable() instead of GetElementsMax()
... which also prevents a (theoretical?) overflow of size*size.
Change-Id: I11e27718c9750ad1b17f6f16bb1b293aa4a2f574
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/tool/interpr5.cxx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx index f9e1bde3b5ad..bd73ecc70b2a 100644 --- a/sc/source/core/tool/interpr5.cxx +++ b/sc/source/core/tool/interpr5.cxx @@ -351,7 +351,7 @@ ScMatrixRef ScInterpreter::CreateMatrixFromDoubleRef( const FormulaToken* pToken SCSIZE nMatCols = static_cast<SCSIZE>(nCol2 - nCol1 + 1); SCSIZE nMatRows = static_cast<SCSIZE>(nRow2 - nRow1 + 1); - if (nMatRows * nMatCols > ScMatrix::GetElementsMax()) + if (!ScMatrix::IsSizeAllocatable( nMatCols, nMatRows)) { SetError(errStackOverflow); return nullptr; @@ -601,7 +601,7 @@ void ScInterpreter::ScEMat() if ( MustHaveParamCount( GetByte(), 1 ) ) { SCSIZE nDim = static_cast<SCSIZE>(::rtl::math::approxFloor(GetDouble())); - if ( nDim * nDim > ScMatrix::GetElementsMax() || nDim == 0) + if (nDim == 0 || !ScMatrix::IsSizeAllocatable( nDim, nDim)) PushIllegalArgument(); else { @@ -800,7 +800,7 @@ void ScInterpreter::ScMatDet() } SCSIZE nC, nR; pMat->GetDimensions(nC, nR); - if ( nC != nR || nC == 0 || (sal_uLong) nC * nC > ScMatrix::GetElementsMax() ) + if ( nC != nR || nC == 0 || !ScMatrix::IsSizeAllocatable( nC, nR) ) PushIllegalArgument(); else { @@ -923,7 +923,7 @@ void ScInterpreter::ScMatInv() } } - if ( nC != nR || nC == 0 || (sal_uLong) nC * nC > ScMatrix::GetElementsMax() ) + if ( nC != nR || nC == 0 || !ScMatrix::IsSizeAllocatable( nC, nR) ) PushIllegalArgument(); else { |