sc/source/core/tool/interpr5.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
New commits: commit 72d710ca5a323b66a77c78f24e7017b1330cca63 Author: Eike Rathke <er...@redhat.com> Date: Mon Mar 7 19:03:16 2016 +0100 use ScMatrix::IsSizeAllocatable() instead of GetElementsMax() ... which also prevents a (theoretical?) overflow of size*size. Change-Id: I11e27718c9750ad1b17f6f16bb1b293aa4a2f574 diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx index f9e1bde..bd73ecc 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 { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits