[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - sc/source
Eike Rathke
erack at redhat.com
Tue Mar 15 21:09:58 UTC 2016
sc/source/core/data/formulacell.cxx | 48 +++++++++++++++++++++---------------
1 file changed, 29 insertions(+), 19 deletions(-)
New commits:
commit b14cc2f16d00c103cf415a54e163d54764d0a86b
Author: Eike Rathke <erack at redhat.com>
Date: Tue Mar 15 17:39:03 2016 +0100
Resolves: tdf#93196 add RecursionCounter guard also to InterpretFormulaGroup()
... same as for ScFormulaCell::InterpretTail()
Change-Id: I444f259fe4e86ed0638a04f1b5d9272edd182e2e
(cherry picked from commit 29ee431c1cf859c3d5a5041cff5cb04b89db27a0)
Reviewed-on: https://gerrit.libreoffice.org/23280
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 36c64e1..b34261b 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -1438,6 +1438,28 @@ bool ScFormulaCell::MarkUsedExternalReferences()
return pCode && pDocument->MarkUsedExternalReferences(*pCode, aPos);
}
+namespace {
+class RecursionCounter
+{
+ ScRecursionHelper& rRec;
+ bool bStackedInIteration;
+public:
+ RecursionCounter( ScRecursionHelper& r, ScFormulaCell* p ) : rRec(r)
+ {
+ bStackedInIteration = rRec.IsDoingIteration();
+ if (bStackedInIteration)
+ rRec.GetRecursionInIterationStack().push( p);
+ rRec.IncRecursionCount();
+ }
+ ~RecursionCounter()
+ {
+ rRec.DecRecursionCount();
+ if (bStackedInIteration)
+ rRec.GetRecursionInIterationStack().pop();
+ }
+};
+}
+
void ScFormulaCell::Interpret()
{
if (!IsDirtyOrInTableOpDirty() || pDocument->GetRecursionHelper().IsInReturn())
@@ -1680,25 +1702,7 @@ void ScFormulaCell::Interpret()
void ScFormulaCell::InterpretTail( ScInterpretTailParameter eTailParam )
{
- class RecursionCounter
- {
- ScRecursionHelper& rRec;
- bool bStackedInIteration;
- public:
- RecursionCounter( ScRecursionHelper& r, ScFormulaCell* p ) : rRec(r)
- {
- bStackedInIteration = rRec.IsDoingIteration();
- if (bStackedInIteration)
- rRec.GetRecursionInIterationStack().push( p);
- rRec.IncRecursionCount();
- }
- ~RecursionCounter()
- {
- rRec.DecRecursionCount();
- if (bStackedInIteration)
- rRec.GetRecursionInIterationStack().pop();
- }
- } aRecursionCounter( pDocument->GetRecursionHelper(), this);
+ RecursionCounter aRecursionCounter( pDocument->GetRecursionHelper(), this);
nSeenInIteration = pDocument->GetRecursionHelper().GetIteration();
if( !pCode->GetCodeLen() && !pCode->GetCodeError() )
{
@@ -3844,6 +3848,12 @@ bool ScFormulaCell::InterpretFormulaGroup()
if (!officecfg::Office::Common::Misc::UseOpenCL::get())
return false;
+ // Guard against endless recursion of Interpret() calls, for this to work
+ // ScFormulaCell::InterpretFormulaGroup() must never be called through
+ // anything else than ScFormulaCell::Interpret(), same as
+ // ScFormulaCell::InterpretTail()
+ RecursionCounter aRecursionCounter( pDocument->GetRecursionHelper(), this);
+
// TODO : Disable invariant formula group interpretation for now in order
// to get implicit intersection to work.
if (mxGroup->mbInvariant && false)
More information about the Libreoffice-commits
mailing list