summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/tool/scmatrix.cxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index 2de6ea8d5c52..c012bc8dcd89 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -2758,7 +2758,13 @@ bool ScMatrix::IsSizeAllocatable( SCSIZE nC, SCSIZE nR )
SAL_WARN( "sc.core", "ScMatrix one-dimensional zero: " << nC << " columns * " << nR << " rows");
return false;
}
- if (nC && nR && (nC > (ScMatrix::GetElementsMax() / nR)))
+ if (!nC || !nR)
+ return true;
+
+ static size_t nElementsMax = std::getenv("SC_MAX_MATRIX_ELEMENTS") ? std::atoi(std::getenv("SC_MAX_MATRIX_ELEMENTS"))
+ : ScMatrix::GetElementsMax();
+
+ if (nC > (nElementsMax / nR))
{
SAL_WARN( "sc.core", "ScMatrix overflow: " << nC << " columns * " << nR << " rows");
return false;