aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2013-10-11 14:35:51 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-11 19:36:53 +0200
commita4449295c3051e42b1aa80a1c7cc91671ad05765 (patch)
tree9d2068cdbcaff83128747316f3a1ca98f3dc7d40 /src/qml
parentd736b58d2481af9c68879d75ba73cee47e9837e1 (diff)
Fix crash in duplicate labelled statement check
Testcase (part of parserstress in tests/auto/qml): outer: { do { inner: {} } while (false) } The labelled statement visitor, when hitting the outter label, would call enterLoop(), which sets _labelledStatement back to zero. That then gets added to the Loop object the do-while loop creates, and the duplicate labelled statement check then for inner would unconditionally dereference loop->labelledStatement. In all other places where we access loop->labelledStatement we have a null pointer check, so let's have one here as well. Change-Id: I9d5925a2abf4db691c49c0cdec3550938ee02efa Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml')
-rw-r--r--src/qml/compiler/qv4codegen.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp
index 43756a6f35..94562ead7f 100644
--- a/src/qml/compiler/qv4codegen.cpp
+++ b/src/qml/compiler/qv4codegen.cpp
@@ -2116,7 +2116,7 @@ bool Codegen::visit(LabelledStatement *ast)
// check that no outer loop contains the label
Loop *l = _loop;
while (l) {
- if (l->labelledStatement->label == ast->label) {
+ if (l->labelledStatement && l->labelledStatement->label == ast->label) {
QString error = QString(QStringLiteral("Label '%1' has already been declared")).arg(ast->label.toString());
throwSyntaxError(ast->firstSourceLocation(), error);
}