From 0576ad6d35e59ec49d934841abbd45ffb6ed5866 Mon Sep 17 00:00:00 2001 From: Tamas Berghammer Date: Fri, 22 Jul 2016 10:43:03 +0000 Subject: [PATCH] Fix a crash when an ELF section symbol have no name llvm-svn: 276403 --- lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp index a60daa2..fc43c46 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -2211,10 +2211,12 @@ ObjectFileELF::ParseSymbols (Symtab *symtab, break; const char *symbol_name = strtab_data.PeekCStr(symbol.st_name); + if (!symbol_name) + symbol_name = ""; // No need to add non-section symbols that have no names if (symbol.getType() != STT_SECTION && - (symbol_name == NULL || symbol_name[0] == '\0')) + (symbol_name == nullptr || symbol_name[0] == '\0')) continue; // Skipping oatdata and oatexec sections if it is requested. See details above the @@ -2461,7 +2463,7 @@ ObjectFileELF::ParseSymbols (Symtab *symtab, bool is_global = symbol.getBinding() == STB_GLOBAL; uint32_t flags = symbol.st_other << 8 | symbol.st_info | additional_flags; - bool is_mangled = symbol_name ? (symbol_name[0] == '_' && symbol_name[1] == 'Z') : false; + bool is_mangled = (symbol_name[0] == '_' && symbol_name[1] == 'Z'); llvm::StringRef symbol_ref(symbol_name); -- 2.7.4