summaryrefslogtreecommitdiff
path: root/sc/source/core/tool/interpr1.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/core/tool/interpr1.cxx')
-rw-r--r--sc/source/core/tool/interpr1.cxx10
1 files changed, 9 insertions, 1 deletions
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 9069138c3013..e375f1626ec5 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -5849,6 +5849,7 @@ void ScInterpreter::IterateParametersIfs( double(*ResultFunc)( const sc::ParamIf
SCROW nStartRowDiff = 0;
SCROW nEndRowDiff = 0;
bool bRangeReduce = false;
+ ScRange aMainRange;
// Range-reduce optimization
if (nParamCount % 2) // Not COUNTIFS
@@ -5872,7 +5873,7 @@ void ScInterpreter::IterateParametersIfs( double(*ResultFunc)( const sc::ParamIf
const ScComplexRefData* pRefData = pMainRangeToken->GetDoubleRef();
if (!pRefData->IsDeleted())
{
- ScRange aMainRange, aSubRange;
+ ScRange aSubRange;
DoubleRefToRange( *pRefData, aMainRange);
if (aMainRange.aStart.Tab() == aMainRange.aEnd.Tab())
@@ -6076,6 +6077,13 @@ void ScInterpreter::IterateParametersIfs( double(*ResultFunc)( const sc::ParamIf
if (bRangeReduce)
{
+ // All reference ranges must be of the same size as the main range.
+ if( aMainRange.aEnd.Col() - aMainRange.aStart.Col() != nCol2 - nCol1
+ || aMainRange.aEnd.Row() - aMainRange.aStart.Row() != nRow2 - nRow1)
+ {
+ PushError ( FormulaError::IllegalArgument);
+ return;
+ }
nCol1 += nStartColDiff;
nRow1 += nStartRowDiff;