diff options
author | Erik Verbruggen <erik.verbruggen@qt.io> | 2018-10-11 13:33:08 +0200 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@qt.io> | 2018-11-29 08:43:19 +0000 |
commit | 597ce09c7a1d8b89e9473faae900321ef2d4181d (patch) | |
tree | 0a64a17098ad83d5b83ccae836b1d5bbe26d8079 /src/qml/compiler/qv4compilerscanfunctions_p.h | |
parent | e7d19a2a0fcbec38b7e132634d0ebe79b772c61b (diff) |
JS: Limit expression and statement nesting level
This is to prevent extremely deeply nested expressions and statements
make the code-generator run out of (native) stack space.
Task-number: QTBUG-71087
Change-Id: I8e1a20a361bff3e49101e535754546475a63ca18
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4compilerscanfunctions_p.h')
-rw-r--r-- | src/qml/compiler/qv4compilerscanfunctions_p.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/qml/compiler/qv4compilerscanfunctions_p.h b/src/qml/compiler/qv4compilerscanfunctions_p.h index bb07540ec9..4463a4f4f3 100644 --- a/src/qml/compiler/qv4compilerscanfunctions_p.h +++ b/src/qml/compiler/qv4compilerscanfunctions_p.h @@ -96,6 +96,9 @@ protected: using Visitor::visit; using Visitor::endVisit; + bool preVisit(AST::Node *ast) override; + void postVisit(AST::Node *) override; + void checkDirectivePrologue(AST::StatementList *ast); void checkName(const QStringRef &name, const AST::SourceLocation &loc); @@ -169,6 +172,8 @@ protected: bool _allowFuncDecls; ContextType defaultProgramType; + unsigned _recursionDepth = 0; + private: static constexpr AST::Node *astNodeForGlobalEnvironment = nullptr; }; |