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

Change-Id: Ia17122cc9f3d422530cf722ea528591fce7ab7ff
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 0b3c5816c6d6be52918aa51178f03bd760449eb9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Ivan Solovev 2023-07-13 16:47:23 +02:00 committed by Qt Cherry-pick Bot
parent 9a55243e53
commit 2ead07f210

View File

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