aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmllocale.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-09-20 15:13:14 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-22 15:29:00 +0200
commit1fb3cd12c8cdc76d1986736fbd60b5810cc17045 (patch)
tree700e7e2d29231a57c945e53fe71e2ab2250e8f2a /src/qml/qml/qqmllocale.cpp
parent47bf40dd49f90b52cc1b545b2be3035d48d6199e (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/qml/qqmllocale.cpp')
-rw-r--r--src/qml/qml/qqmllocale.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/qml/qml/qqmllocale.cpp b/src/qml/qml/qqmllocale.cpp
index 85d200e8e6..c3c7d0282d 100644
--- a/src/qml/qml/qqmllocale.cpp
+++ b/src/qml/qml/qqmllocale.cpp
@@ -562,9 +562,11 @@ QV4::ReturnedValue QQmlLocaleData::method_get_uiLanguages(QV4::SimpleCallContext
QStringList langs = locale.uiLanguages();
QV4::Scoped<QV4::ArrayObject> result(scope, ctx->engine->newArrayObject());
result->arrayReserve(langs.size());
- result->arrayDataLen = langs.size();
- for (int i = 0; i < langs.size(); ++i)
+ for (int i = 0; i < langs.size(); ++i) {
result->arrayData[i].value = QV4::Value::fromString(ctx, langs.at(i));
+ result->arrayDataLen = i + 1;
+ }
+
result->setArrayLengthUnchecked(langs.size());
return result.asReturnedValue();