File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed
tests/auto/qml/qqmlparser Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -724,6 +724,11 @@ int Lexer::scanToken()
724
724
return multilineStringLiteral ? T_MULTILINE_STRING_LITERAL : T_STRING_LITERAL;
725
725
} else if (_char == QLatin1Char (' \\ ' )) {
726
726
scanChar ();
727
+ if (_codePtr > _endPtr) {
728
+ _errorCode = IllegalEscapeSequence;
729
+ _errorMessage = QCoreApplication::translate (" QQmlParser" , " End of file reached at escape sequence" );
730
+ return T_ERROR;
731
+ }
727
732
728
733
QChar u;
729
734
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ private slots:
49
49
void qmlParser_data ();
50
50
void qmlParser ();
51
51
#endif
52
+ void invalidEscapeSequence ();
52
53
53
54
private:
54
55
QStringList excludedDirs;
@@ -192,6 +193,17 @@ void tst_qqmlparser::qmlParser()
192
193
}
193
194
#endif
194
195
196
+ void tst_qqmlparser::invalidEscapeSequence ()
197
+ {
198
+ using namespace QQmlJS ;
199
+
200
+ Engine engine;
201
+ Lexer lexer (&engine);
202
+ lexer.setCode (QLatin1String (" \"\\ " ), 1 );
203
+ Parser parser (&engine);
204
+ parser.parse ();
205
+ }
206
+
195
207
QTEST_MAIN (tst_qqmlparser)
196
208
197
209
#include " tst_qqmlparser.moc"
You can’t perform that action at this time.
0 commit comments