From 0b3c5816c6d6be52918aa51178f03bd760449eb9 Mon Sep 17 00:00:00 2001 From: Ivan Solovev Date: Thu, 13 Jul 2023 16:47:23 +0200 Subject: [PATCH] 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 Reviewed-by: Thiago Macieira --- src/corelib/plugin/quuid.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/plugin/quuid.h b/src/corelib/plugin/quuid.h index 299ce76d7b..ddd24eb678 100644 --- a/src/corelib/plugin/quuid.h +++ b/src/corelib/plugin/quuid.h @@ -55,7 +55,7 @@ public: Id128 = 3 }; - union Id128Bytes { + union alignas(16) Id128Bytes { quint8 data[16]; quint16 data16[8]; quint32 data32[4];