From: Rohan McGovern Date: Tue, 1 May 2012 05:02:48 +0000 (+1000) Subject: Fixed uninitialized memory in QMetaObjectBuilder::fromRelocatableData X-Git-Tag: 071012110112~1292 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=40a73d7c63950caef47571ce9c53624e86324db3;p=profile%2Fivi%2Fqtbase.git Fixed uninitialized memory in QMetaObjectBuilder::fromRelocatableData static_metacall was never set on the metaobject written by QMetaObjectBuilder::fromRelocatableData, sometimes causing a crash. It should be initialized to 0. Change-Id: I79373d895e131f0cc2ff1af6d2177a0c1a282be7 Reviewed-by: Toby Tomkins Reviewed-by: Olivier Goffart --- diff --git a/src/corelib/kernel/qmetaobjectbuilder.cpp b/src/corelib/kernel/qmetaobjectbuilder.cpp index 7736181..16ff58e 100644 --- a/src/corelib/kernel/qmetaobjectbuilder.cpp +++ b/src/corelib/kernel/qmetaobjectbuilder.cpp @@ -1536,6 +1536,7 @@ void QMetaObjectBuilder::fromRelocatableData(QMetaObject *output, output->d.data = reinterpret_cast(buf + dataOffset); output->d.extradata = 0; output->d.relatedMetaObjects = 0; + output->d.static_metacall = 0; } /*! diff --git a/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp b/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp index 8ae79e0..cfb2398 100644 --- a/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp +++ b/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp @@ -1097,6 +1097,11 @@ void tst_QMetaObjectBuilder::relocatableData() QMetaObject *meta = builder.toMetaObject(); QVERIFY(sameMetaObject(meta, &meta2)); + + QVERIFY(!meta2.d.extradata); + QVERIFY(!meta2.d.relatedMetaObjects); + QVERIFY(!meta2.d.static_metacall); + free(meta); }