[Libreoffice-commits] core.git: formula/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Thu Feb 11 11:19:50 UTC 2021
formula/source/core/api/FormulaCompiler.cxx | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
New commits:
commit 7c6117235ce4112154c416dee6f495672dab9993
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Feb 11 09:52:31 2021 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Feb 11 12:19:02 2021 +0100
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 at redhat.com>
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
More information about the Libreoffice-commits
mailing list