aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/parser
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/parser')
-rw-r--r--src/qml/parser/qqmljs.g10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/qml/parser/qqmljs.g b/src/qml/parser/qqmljs.g
index 6549e5bfa3..860a4e999e 100644
--- a/src/qml/parser/qqmljs.g
+++ b/src/qml/parser/qqmljs.g
@@ -614,8 +614,16 @@ bool Parser::parse(int startToken)
program = 0;
do {
- if (++tos == stack_size)
+ if (++tos == stack_size) {
reallocateStack();
+ if (stack_size > 10000) {
+ // We're now in some serious right-recursive stuff, which will probably result in
+ // an AST that's so deep that recursively visiting it will run out of stack space.
+ const QString msg = QCoreApplication::translate("QQmlParser", "Maximum statement or expression depth exceeded");
+ diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
+ return false;
+ }
+ }
state_stack[tos] = action;