llvm-project/llvm/tools/llvm-objcopy/MachO
Daniel Rodríguez Troitiño 8fbe1e7602 [llvm-objcopy] Fix misaligned access to load command data.
It seems that llvm-objcopy stores data temporarily misaligned with the
requirements of the underlaying struct from libBinaryFormat, and UBSan
generates a runtime error.

Instead of trying to reinterpret the memory as the struct itself, simply
access the `char *` pointer that we are interested in, and that do not
have alignment restrictions.

This problem was pointed out in a comment of D111164.

Differential Revision: https://reviews.llvm.org/D112744
2021-10-28 22:14:39 -07:00
..
MachOConfig.h [llvm-objcopy][NFC] Refactor CopyConfig structure - categorize options. 2021-09-08 19:16:38 +03:00
MachOLayoutBuilder.cpp Regenerate LC_CODE_SIGNATURE during llvm-objcopy operations 2021-10-26 14:51:13 -07:00
MachOLayoutBuilder.h Regenerate LC_CODE_SIGNATURE during llvm-objcopy operations 2021-10-26 14:51:13 -07:00
MachOObjcopy.cpp Regenerate LC_CODE_SIGNATURE during llvm-objcopy operations 2021-10-26 14:51:13 -07:00
MachOObjcopy.h [llvm-objcopy][NFC] Refactor CopyConfig structure - categorize options. 2021-09-08 19:16:38 +03:00
MachOReader.cpp [llvm-objcopy] Fix misaligned access to load command data. 2021-10-28 22:14:39 -07:00
MachOReader.h [llvm-objcopy][MachO] Support LC_LINKER_OPTIMIZATION_HINT load command 2021-06-29 18:47:55 -07:00
MachOWriter.cpp Regenerate LC_CODE_SIGNATURE during llvm-objcopy operations 2021-10-26 14:51:13 -07:00
MachOWriter.h Regenerate LC_CODE_SIGNATURE during llvm-objcopy operations 2021-10-26 14:51:13 -07:00
Object.cpp Regenerate LC_CODE_SIGNATURE during llvm-objcopy operations 2021-10-26 14:51:13 -07:00
Object.h Regenerate LC_CODE_SIGNATURE during llvm-objcopy operations 2021-10-26 14:51:13 -07:00