diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-09-20 15:13:14 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-22 15:29:00 +0200 |
commit | 1fb3cd12c8cdc76d1986736fbd60b5810cc17045 (patch) | |
tree | 700e7e2d29231a57c945e53fe71e2ab2250e8f2a /src/qml/jsruntime/qv4jsonobject.cpp | |
parent | 47bf40dd49f90b52cc1b545b2be3035d48d6199e (diff) |
Fix cases where mark() would access uninitialized memory
Change-Id: I4e07e20d30ba57759a0ece1c298a02b098718b33
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4jsonobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4jsonobject.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4jsonobject.cpp b/src/qml/jsruntime/qv4jsonobject.cpp index f311dfd420..5d1669dd8b 100644 --- a/src/qml/jsruntime/qv4jsonobject.cpp +++ b/src/qml/jsruntime/qv4jsonobject.cpp @@ -1036,9 +1036,10 @@ QV4::ReturnedValue JsonObject::fromJsonArray(ExecutionEngine *engine, const QJso int size = array.size(); Scoped<ArrayObject> a(scope, engine->newArrayObject()); a->arrayReserve(size); - a->arrayDataLen = size; - for (int i = 0; i < size; i++) + for (int i = 0; i < size; i++) { a->arrayData[i].value = Value::fromReturnedValue(fromJsonValue(engine, array.at(i))); + a->arrayDataLen = i + 1; + } a->setArrayLengthUnchecked(size); return a.asReturnedValue(); } |