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 <toby.tomkins@nokia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
bb10
Rohan McGovern 2012-05-01 15:02:48 +10:00 committed by Qt by Nokia
parent e1d5355325
commit 40a73d7c63
2 changed files with 6 additions and 0 deletions

View File

@ -1536,6 +1536,7 @@ void QMetaObjectBuilder::fromRelocatableData(QMetaObject *output,
output->d.data = reinterpret_cast<const uint *>(buf + dataOffset);
output->d.extradata = 0;
output->d.relatedMetaObjects = 0;
output->d.static_metacall = 0;
}
/*!

View File

@ -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);
}