[Lldb-commits] [lldb] 61cf9f4 - [ObjectFilePECOFF] Try to avoid unaligned access.
Davide Italiano via lldb-commits
lldb-commits at lists.llvm.org
Tue Jul 14 18:53:31 PDT 2020
Author: Davide Italiano
Date: 2020-07-14T18:53:23-07:00
New Revision: 61cf9f4e723bd9522757931706b208a1357c30ba
URL: https://github.com/llvm/llvm-project/commit/61cf9f4e723bd9522757931706b208a1357c30ba
DIFF: https://github.com/llvm/llvm-project/commit/61cf9f4e723bd9522757931706b208a1357c30ba.diff
LOG: [ObjectFilePECOFF] Try to avoid unaligned access.
Fixes an UBSAN error.
Added:
Modified:
lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
Removed:
################################################################################
diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
index 39808cdec790..d606b49130c4 100644
--- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -656,7 +656,7 @@ Symtab *ObjectFilePECOFF::GetSymtab() {
// because it is used as offset 0 to encode a NULL string.
uint32_t *strtab_data_start = const_cast<uint32_t *>(
reinterpret_cast<const uint32_t *>(strtab_data.GetDataStart()));
- strtab_data_start[0] = 0;
+ ::memset(&strtab_data_start[0], 0, sizeof(uint32_t));
offset = 0;
std::string symbol_name;
More information about the lldb-commits
mailing list