[Lldb-commits] [lldb] r276403 - Fix a crash when an ELF section symbol have no name

Tamas Berghammer via lldb-commits lldb-commits at lists.llvm.org
Fri Jul 22 03:43:04 PDT 2016


Author: tberghammer
Date: Fri Jul 22 05:43:03 2016
New Revision: 276403

URL: http://llvm.org/viewvc/llvm-project?rev=276403&view=rev
Log:
Fix a crash when an ELF section symbol have no name

Modified:
    lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp?rev=276403&r1=276402&r2=276403&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Fri Jul 22 05:43:03 2016
@@ -2211,10 +2211,12 @@ ObjectFileELF::ParseSymbols (Symtab *sym
             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 *sym
 
         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);
 




More information about the lldb-commits mailing list