diff options
author | Eike Rathke <erack@redhat.com> | 2016-03-23 14:26:55 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-03-23 16:40:06 +0000 |
commit | c2728179ddd42793319988cc3e6014ee1971c1cf (patch) | |
tree | f0e7d7f1660eff7ce09557b52fafd5d2ea75fab9 /sc | |
parent | 3fcf08549baaa23c2d4c12d7a87ff24becc4fba2 (diff) |
add a recursion guard to lcl_FindRangeNamesInUse()
Change-Id: Ifbc02304f5a2e080db2d6645e2c7f825a2c56cb5
Reviewed-on: https://gerrit.libreoffice.org/23472
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/formulacell.cxx | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 8ab094c9c747..d9f48e1f38ee 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -3678,7 +3678,8 @@ void ScFormulaCell::UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY StartListeningTo( pDocument ); // Listener as previous } -static void lcl_FindRangeNamesInUse(std::set<sal_uInt16>& rIndexes, ScTokenArray* pCode, ScRangeName* pNames) +static void lcl_FindRangeNamesInUse(std::set<sal_uInt16>& rIndexes, ScTokenArray* pCode, ScRangeName* pNames, + int nRecursion) { for (FormulaToken* p = pCode->First(); p; p = pCode->Next()) { @@ -3687,16 +3688,19 @@ static void lcl_FindRangeNamesInUse(std::set<sal_uInt16>& rIndexes, ScTokenArray sal_uInt16 nTokenIndex = p->GetIndex(); rIndexes.insert( nTokenIndex ); - ScRangeData* pSubName = pNames->findByIndex(p->GetIndex()); - if (pSubName) - lcl_FindRangeNamesInUse(rIndexes, pSubName->GetCode(), pNames); + if (nRecursion < 126) // whatever.. 42*3 + { + ScRangeData* pSubName = pNames->findByIndex(p->GetIndex()); + if (pSubName) + lcl_FindRangeNamesInUse(rIndexes, pSubName->GetCode(), pNames, nRecursion+1); + } } } } void ScFormulaCell::FindRangeNamesInUse(std::set<sal_uInt16>& rIndexes) const { - lcl_FindRangeNamesInUse( rIndexes, pCode, pDocument->GetRangeName() ); + lcl_FindRangeNamesInUse( rIndexes, pCode, pDocument->GetRangeName(), 0); } void ScFormulaCell::SetChanged(bool b) |