aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qml/qml/parser/qqmljslexer.cpp7
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.4.js2
-rw-r--r--tests/auto/qml/qmlmin/tst_qmlmin.cpp1
-rw-r--r--tests/auto/qml/qqmlecmascript/data/stringParsing_error.5.qml9
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp2
5 files changed, 16 insertions, 5 deletions
diff --git a/src/qml/qml/parser/qqmljslexer.cpp b/src/qml/qml/parser/qqmljslexer.cpp
index 508d7581be..532826f15c 100644
--- a/src/qml/qml/parser/qqmljslexer.cpp
+++ b/src/qml/qml/parser/qqmljslexer.cpp
@@ -659,8 +659,11 @@ again:
// unicode escape sequence
case 'u':
u = decodeUnicodeEscapeCharacter(&ok);
- if (! ok)
- u = _char;
+ if (! ok) {
+ _errorCode = IllegalUnicodeEscapeSequence;
+ _errorMessage = QCoreApplication::translate("QQmlParser", "Illegal unicode escape sequence");
+ return T_ERROR;
+ }
break;
// hex escape sequence
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.4.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.4.js
index 92a04942c7..4a3173db6c 100644
--- a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.4.js
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.4.js
@@ -155,10 +155,8 @@ new TestCase( SECTION, "\\o", "o", "\o" );
new TestCase( SECTION, "\\p", "p", "\p" );
new TestCase( SECTION, "\\q", "q", "\q" );
new TestCase( SECTION, "\\s", "s", "\s" );
-new TestCase( SECTION, "\\u", "u", "\u" );
new TestCase( SECTION, "\\w", "w", "\w" );
-new TestCase( SECTION, "\\x", "x", "\x" );
new TestCase( SECTION, "\\y", "y", "\y" );
new TestCase( SECTION, "\\z", "z", "\z" );
diff --git a/tests/auto/qml/qmlmin/tst_qmlmin.cpp b/tests/auto/qml/qmlmin/tst_qmlmin.cpp
index 3cda6c0885..3fb51512d9 100644
--- a/tests/auto/qml/qmlmin/tst_qmlmin.cpp
+++ b/tests/auto/qml/qmlmin/tst_qmlmin.cpp
@@ -124,6 +124,7 @@ void tst_qmlmin::initTestCase()
invalidFiles << "tests/auto/qml/qqmlecmascript/data/stringParsing_error.2.qml";
invalidFiles << "tests/auto/qml/qqmlecmascript/data/stringParsing_error.3.qml";
invalidFiles << "tests/auto/qml/qqmlecmascript/data/stringParsing_error.4.qml";
+ invalidFiles << "tests/auto/qml/qqmlecmascript/data/stringParsing_error.5.qml";
invalidFiles << "tests/auto/qml/qqmlecmascript/data/numberParsing_error.1.qml";
invalidFiles << "tests/auto/qml/qqmlecmascript/data/numberParsing_error.2.qml";
}
diff --git a/tests/auto/qml/qqmlecmascript/data/stringParsing_error.5.qml b/tests/auto/qml/qqmlecmascript/data/stringParsing_error.5.qml
new file mode 100644
index 0000000000..563e01a995
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/stringParsing_error.5.qml
@@ -0,0 +1,9 @@
+
+import QtQuick 2.0
+
+QtObject {
+ function code() {
+ var x = "\u000G";
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index fb6efcaf5d..baee10055b 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -7364,7 +7364,7 @@ void tst_qqmlecmascript::numberParsing()
void tst_qqmlecmascript::stringParsing()
{
- for (int i = 1; i < 5; ++i) {
+ for (int i = 1; i < 6; ++i) {
QString file("stringParsing_error.%1.qml");
file = file.arg(i);
QQmlComponent component(&engine, testFileUrl(file));