diff options
author | Martin Storsjö <martin@martin.st> | 2023-04-18 15:42:35 +0300 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2023-04-22 22:47:45 +0300 |
commit | f6320f5e0e63268049086d17e903ee9bc80a996d (patch) | |
tree | 03063a577b915ad3e906dd29a8d89dba831876a3 /libunwind | |
parent | 745221268125e86b1543a7aa643414e9cc8cb2d2 (diff) | |
download | llvm-f6320f5e0e63268049086d17e903ee9bc80a996d.tar.gz |
[libunwind] [SEH] Clear DISPATCHER_CONTEXT when initializing a cursor
We only initialize a few fields in DISPATCHER_CONTEXT - don't leave
the rest in an uninitialized state; make sure the whole struct is
in a deterministic state.
This makes nondeterministic failures deterministic, for some cases
relating to forced unwinding on aarch64/arm (which requires filling
in parsing of the xdata for finding the exception handler and LSDA).
Differential Revision: https://reviews.llvm.org/D148660
Diffstat (limited to 'libunwind')
-rw-r--r-- | libunwind/src/UnwindCursor.hpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libunwind/src/UnwindCursor.hpp b/libunwind/src/UnwindCursor.hpp index 8b6451c68b46..db6d0ec853f3 100644 --- a/libunwind/src/UnwindCursor.hpp +++ b/libunwind/src/UnwindCursor.hpp @@ -575,6 +575,7 @@ UnwindCursor<A, R>::UnwindCursor(unw_context_t *context, A &as) "UnwindCursor<> requires more alignment than unw_cursor_t"); memset(&_info, 0, sizeof(_info)); memset(&_histTable, 0, sizeof(_histTable)); + memset(&_dispContext, 0, sizeof(_dispContext)); _dispContext.ContextRecord = &_msContext; _dispContext.HistoryTable = &_histTable; // Initialize MS context from ours. @@ -677,6 +678,7 @@ UnwindCursor<A, R>::UnwindCursor(CONTEXT *context, A &as) "UnwindCursor<> does not fit in unw_cursor_t"); memset(&_info, 0, sizeof(_info)); memset(&_histTable, 0, sizeof(_histTable)); + memset(&_dispContext, 0, sizeof(_dispContext)); _dispContext.ContextRecord = &_msContext; _dispContext.HistoryTable = &_histTable; _msContext = *context; |