aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlparser
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2019-02-15 14:04:54 +0100
committerUlf Hermann <ulf.hermann@qt.io>2019-02-18 07:24:08 +0000
commit885e4af1f4ba3f047c3d932a1a780ddbba481170 (patch)
tree0ff818ac338c3fbe400fb5380c14c074ca8553b8 /tests/auto/qml/qqmlparser
parent94d30df911dccd830a18d7c2e75397505ef9a600 (diff)
QML: Don't crash the parser on certain kinds of bad input
Fixes: QTBUG-72734 Change-Id: I92146ec517c6a26a67e13830618e137f2a3021c2 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmlparser')
-rw-r--r--tests/auto/qml/qqmlparser/tst_qqmlparser.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp b/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp
index ce9d0ac894..c2c73935c0 100644
--- a/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp
+++ b/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp
@@ -53,6 +53,7 @@ private slots:
void stringLiteral();
void noSubstitutionTemplateLiteral();
void templateLiteral();
+ void leadingSemicolonInClass();
private:
QStringList excludedDirs;
@@ -274,6 +275,15 @@ void tst_qqmlparser::templateLiteral()
QVERIFY(e);
}
+void tst_qqmlparser::leadingSemicolonInClass()
+{
+ QQmlJS::Engine engine;
+ QQmlJS::Lexer lexer(&engine);
+ lexer.setCode(QLatin1String("class X{;n(){}}"), 1);
+ QQmlJS::Parser parser(&engine);
+ QVERIFY(parser.parseProgram());
+}
+
QTEST_MAIN(tst_qqmlparser)
#include "tst_qqmlparser.moc"