QMetaObjectBuilder: Avoid arithmetic on null pointer
In Prepare mode, "buf" is a null pointer. We never dereference it, but we still compute an offset from it to obtain a pointer to a (then unused) QMetaObjectPrivater. clang's UBSan complains about this, so initialize the pointer to nullptr instead when in Prepare mode. Pick-to: 6.7 6.6 6.5 Change-Id: Id9d78058f72bb1b44440d07f565374f3eb3c20fd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>bb10
parent
c60db31883
commit
d3d224f546
|
|
@ -1162,8 +1162,8 @@ static int buildMetaObject(QMetaObjectBuilderPrivate *d, char *buf,
|
|||
}
|
||||
|
||||
// Populate the QMetaObjectPrivate structure.
|
||||
QMetaObjectPrivate *pmeta
|
||||
= reinterpret_cast<QMetaObjectPrivate *>(buf + size);
|
||||
QMetaObjectPrivate *pmeta = buf ? reinterpret_cast<QMetaObjectPrivate *>(buf + size)
|
||||
: nullptr;
|
||||
//int pmetaSize = size;
|
||||
dataIndex = MetaObjectPrivateFieldCount;
|
||||
int methodParametersDataSize =
|
||||
|
|
|
|||
Loading…
Reference in New Issue