From 885e4af1f4ba3f047c3d932a1a780ddbba481170 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Fri, 15 Feb 2019 14:04:54 +0100 Subject: QML: Don't crash the parser on certain kinds of bad input Fixes: QTBUG-72734 Change-Id: I92146ec517c6a26a67e13830618e137f2a3021c2 Reviewed-by: Simon Hausmann --- tests/auto/qml/qqmlparser/tst_qqmlparser.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests/auto/qml/qqmlparser') 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" -- cgit v1.2.3