summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-12-04 16:03:59 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-12-04 18:34:03 +0100
commit725118563976bd5abd1c368b90579dbf44462323 (patch)
tree4393c30f3b7501eb90280cf672d18fb70ed0e22e /tests
parent20d2e3faf8b08fb70fdbca586db1d3839af4146a (diff)
Fix a crash in JSON.parse
Properly set members that are actually array indices and don't crash when trying to set those. Task-number: QTBUG-35383 Change-Id: I04d4b65c27e97a2e9db19541ed46ee1bb202f780 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/qjsengine/tst_qjsengine.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
index 39086d75ac..726f8636b6 100644
--- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp
+++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
@@ -134,6 +134,7 @@ private slots:
void reentrancy_Array();
void reentrancy_objectCreation();
void jsIncDecNonObjectProperty();
+ void JSONparse();
void qRegExpInport_data();
void qRegExpInport();
@@ -2500,6 +2501,13 @@ void tst_QJSEngine::jsIncDecNonObjectProperty()
}
}
+void tst_QJSEngine::JSONparse()
+{
+ QJSEngine eng;
+ QJSValue ret = eng.evaluate("var json=\"{\\\"1\\\": null}\"; JSON.parse(json);");
+ QVERIFY(ret.isObject());
+}
+
static QRegExp minimal(QRegExp r) { r.setMinimal(true); return r; }
void tst_QJSEngine::qRegExpInport_data()