edk2/BaseTools/Source
Mike Beaton 12751d48e2 BaseTools/VfrCompile: Fix EFI_GUID unaligned access
The memmove in SetClassGuid at line 684 generates a
`store to misaligned address` runtime warning when
VfrCompile is compiled with clang UBSan.

We can avoid generating code which stores to a misaligned
address in a least a couple of other ways than done here,
including casting the destination pointer of the memmove
to (VOID *), or compiling with `-fno-builtin-memmove`.

However, maintaining an unaligned pointer to an aligned
type is, strictly speaking, undefined behaviour in the
c/c++ standard (regardless of how it is or is not then
accessed).

So here we resolve the actual incorrect semantics of this
part of the code (and thereby fix the unaligned access) by
introducing a PACKED_EFI_GUID type in VfrUtilityLib.h, and
using it for this unaligned access.

Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
2025-12-03 12:29:51 +00:00
..
C BaseTools/VfrCompile: Fix EFI_GUID unaligned access 2025-12-03 12:29:51 +00:00
Python BaseTools: AutoGen: Optimize tuple creation using tuple() for PcdDbBuffer 2025-12-02 02:21:22 +00:00