summaryrefslogtreecommitdiff
path: root/formula
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-02-11 09:52:31 +0000
committerCaolán McNamara <caolanm@redhat.com>2021-02-11 12:19:02 +0100
commit7c6117235ce4112154c416dee6f495672dab9993 (patch)
tree68d9cebc568ec9815d7e5f3bdbc5bac57e865599 /formula
parent7dfb69f53472cdeb21270e850892f82112ad332c (diff)
ofz#30812 protect NextToken calling NextToken with RecurseGuard
and bump limit from 42 to 100 Change-Id: I0a35b32e7ab74a4148197ba48c52b6714bdb449d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110756 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'formula')
-rw-r--r--formula/source/core/api/FormulaCompiler.cxx5
1 files changed, 4 insertions, 1 deletions
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index 8e986de15dca..c4e037f624cd 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -1240,7 +1240,7 @@ void FormulaCompiler::AppendErrorConstant( OUStringBuffer& rBuffer, FormulaError
rBuffer.append( mxSymbols->getSymbol( eOp));
}
-constexpr short nRecursionMax = 42;
+constexpr short nRecursionMax = 100;
bool FormulaCompiler::GetToken()
{
@@ -2534,7 +2534,10 @@ OpCode FormulaCompiler::NextToken()
// Operator and Plus => operator
if (eOp == ocAdd && (eLastOp == ocOpen || eLastOp == ocSep ||
(SC_OPCODE_START_BIN_OP <= eLastOp && eLastOp < SC_OPCODE_STOP_UN_OP)))
+ {
+ FormulaCompilerRecursionGuard aRecursionGuard( nRecursion );
eOp = NextToken();
+ }
else
{
// Before an operator there must not be another operator, with the