diff options
author | Eric Fiselier <eric@efcs.ca> | 2016-10-05 22:55:10 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2016-10-05 22:55:10 +0000 |
commit | ae34c56ee77ba6f9096dcec543d99d9ab87a6718 (patch) | |
tree | d9374a630e6963b8a768062f56e4c208f214d684 /lldb/source/Commands/CommandObjectThread.cpp | |
parent | 5d0fbbbca13960f7c996fc6f36ece35b652d7c4d (diff) | |
download | llvm-ae34c56ee77ba6f9096dcec543d99d9ab87a6718.zip llvm-ae34c56ee77ba6f9096dcec543d99d9ab87a6718.tar.gz llvm-ae34c56ee77ba6f9096dcec543d99d9ab87a6718.tar.bz2 |
Fix strict-aliasing violation in typeinfo::hash_code()
Summary:
The current implementation of `hash_code()` for uniqued RTTI strings violates strict aliasing by dereferencing a type-punned pointer. Specifically it generates a `const char**` pointer from the address of the `__name` member before casting it to `const size_t*` and dereferencing it to get the hash. This is really just a complex and incorrect way of writing `reinterpret_cast<size_t>(__name)`.
This patch changes the conversion sequence so that it no longer contains UB.
Reviewers: howard.hinnant, mclow.lists
Subscribers: rjmccall, cfe-commits
Differential Revision: https://reviews.llvm.org/D24012
llvm-svn: 283408
Diffstat (limited to 'lldb/source/Commands/CommandObjectThread.cpp')
0 files changed, 0 insertions, 0 deletions