Skip to content

Commit 710590e

Browse files
[libunwind] Undefined behaviour pointer arithmetic with null pointer (#98648)
Fixes #91144
1 parent dd8a9e2 commit 710590e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

libunwind/src/UnwindCursor.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,8 @@ void DwarfFDECache<A>::iterateCacheEntries(void (*func)(
230230
}
231231
#endif // defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND)
232232

233-
234-
#define arrayoffsetof(type, index, field) ((size_t)(&((type *)0)[index].field))
233+
#define arrayoffsetof(type, index, field) \
234+
(sizeof(type) * (index) + offsetof(type, field))
235235

236236
#if defined(_LIBUNWIND_SUPPORT_COMPACT_UNWIND)
237237
template <typename A> class UnwindSectionHeader {

0 commit comments

Comments
 (0)