Explicitly specify the alignment of QUuid::Id128Bytes union

... because otherwise the union can change its alignment based on
the presence of the data128 member.
For example, QtBluetooth explicitly #undef's __SIZEOF_INT128__ in
its removed_api.cpp, which leads to UB without this patch.

Found during API review

Pick-to: 6.6
Change-Id: Ia17122cc9f3d422530cf722ea528591fce7ab7ff
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Ivan Solovev 2023-07-13 16:47:23 +02:00
parent 0393fa6bf2
commit 0b3c5816c6

View File

@ -55,7 +55,7 @@ public:
Id128 = 3
};
union Id128Bytes {
union alignas(16) Id128Bytes {
quint8 data[16];
quint16 data16[8];
quint32 data32[4];