aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime
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 /src/qml/jsruntime
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 'src/qml/jsruntime')
-rw-r--r--src/qml/jsruntime/qv4jsonobject.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4jsonobject.cpp b/src/qml/jsruntime/qv4jsonobject.cpp
index 458b46b36e..5aac8c8197 100644
--- a/src/qml/jsruntime/qv4jsonobject.cpp
+++ b/src/qml/jsruntime/qv4jsonobject.cpp
@@ -284,8 +284,13 @@ bool JsonParser::parseMember(ObjectRef o)
return false;
ScopedString s(scope, context->engine->newIdentifier(key));
- Property *p = o->insertMember(s, Attr_Data);
- p->value = val.asReturnedValue();
+ uint idx = s->asArrayIndex();
+ if (idx < UINT_MAX) {
+ o->putIndexed(idx, val);
+ } else {
+ Property *p = o->insertMember(s, Attr_Data);
+ p->value = val.asReturnedValue();
+ }
END;
return true;