Author: Daniel Kiss Date: 2024-08-05T11:16:51+02:00 New Revision: 710590e33d19649f08c716d827eb465e3a132d23
URL: https://github.com/llvm/llvm-project/commit/710590e33d19649f08c716d827eb465e3a132d23 DIFF: https://github.com/llvm/llvm-project/commit/710590e33d19649f08c716d827eb465e3a132d23.diff LOG: [libunwind] Undefined behaviour pointer arithmetic with null pointer (#98648) Fixes #91144 Added: Modified: libunwind/src/UnwindCursor.hpp Removed: ################################################################################ diff --git a/libunwind/src/UnwindCursor.hpp b/libunwind/src/UnwindCursor.hpp index 06e654197351d..ce6dced535e78 100644 --- a/libunwind/src/UnwindCursor.hpp +++ b/libunwind/src/UnwindCursor.hpp @@ -230,8 +230,8 @@ void DwarfFDECache<A>::iterateCacheEntries(void (*func)( } #endif // defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) - -#define arrayoffsetof(type, index, field) ((size_t)(&((type *)0)[index].field)) +#define arrayoffsetof(type, index, field) \ + (sizeof(type) * (index) + offsetof(type, field)) #if defined(_LIBUNWIND_SUPPORT_COMPACT_UNWIND) template <typename A> class UnwindSectionHeader { _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits