summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2016-03-23 14:17:19 +0100
committerEike Rathke <erack@redhat.com>2016-03-23 14:19:14 +0100
commit8f61630300974b0a41e8b2ea6b9ec87f1c9faa5f (patch)
tree78190114953616110a8d1713eca51b984ace1036
parentef3ca022d9de6eab86b7db5c9d7a88b0c4c8bba2 (diff)
add a recursion guard to lcl_FindRangeNamesInUse()
Change-Id: Ia4a8f0273bb30b696b3499e75fa70e5c1a0981f1
-rw-r--r--sc/source/core/data/formulacell.cxx14
1 files changed, 9 insertions, 5 deletions
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 00badf0d0966..94677ff96b1a 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -3710,7 +3710,8 @@ void ScFormulaCell::UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY
StartListeningTo( pDocument ); // Listener as previous
}
-static void lcl_FindRangeNamesInUse(sc::UpdatedRangeNames& rIndexes, ScTokenArray* pCode, const ScDocument* pDoc)
+static void lcl_FindRangeNamesInUse(sc::UpdatedRangeNames& rIndexes, ScTokenArray* pCode, const ScDocument* pDoc,
+ int nRecursion)
{
for (FormulaToken* p = pCode->First(); p; p = pCode->Next())
{
@@ -3720,16 +3721,19 @@ static void lcl_FindRangeNamesInUse(sc::UpdatedRangeNames& rIndexes, ScTokenArra
SCTAB nTab = p->GetSheet();
rIndexes.setUpdatedName( nTab, nTokenIndex);
- ScRangeData* pSubName = pDoc->FindRangeNameByIndexAndSheet( nTokenIndex, nTab);
- if (pSubName)
- lcl_FindRangeNamesInUse(rIndexes, pSubName->GetCode(), pDoc);
+ if (nRecursion < 126) // whatever.. 42*3
+ {
+ ScRangeData* pSubName = pDoc->FindRangeNameByIndexAndSheet( nTokenIndex, nTab);
+ if (pSubName)
+ lcl_FindRangeNamesInUse(rIndexes, pSubName->GetCode(), pDoc, nRecursion+1);
+ }
}
}
}
void ScFormulaCell::FindRangeNamesInUse(sc::UpdatedRangeNames& rIndexes) const
{
- lcl_FindRangeNamesInUse( rIndexes, pCode, pDocument );
+ lcl_FindRangeNamesInUse( rIndexes, pCode, pDocument, 0);
}
void ScFormulaCell::SetChanged(bool b)