[Lldb-commits] [lldb] r268520 - Fix a SIGSEGV caused by dereferencing a pointer without a null check

Bryan Chan via lldb-commits lldb-commits at lists.llvm.org
Wed May 4 10:24:31 PDT 2016


Author: bryanpkc
Date: Wed May  4 12:24:31 2016
New Revision: 268520

URL: http://llvm.org/viewvc/llvm-project?rev=268520&view=rev
Log:
Fix a SIGSEGV caused by dereferencing a pointer without a null check

Modified:
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp?rev=268520&r1=268519&r2=268520&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp Wed May  4 12:24:31 2016
@@ -943,7 +943,7 @@ DWARFCompileUnit::IndexPrivate (DWARFCom
                     // as our name. If it starts with '_', then it is ok, else compare
                     // the string to make sure it isn't the same and we don't end up
                     // with duplicate entries
-                    if (name != mangled_cstr && ((mangled_cstr[0] == '_') || (name && ::strcmp(name, mangled_cstr) != 0)))
+                    if (name && name != mangled_cstr && ((mangled_cstr[0] == '_') || (::strcmp(name, mangled_cstr) != 0)))
                     {
                         Mangled mangled (ConstString(mangled_cstr), true);
                         func_fullnames.Insert (mangled.GetMangledName(), DIERef(cu_offset, die.GetOffset()));
@@ -966,7 +966,7 @@ DWARFCompileUnit::IndexPrivate (DWARFCom
                     // as our name. If it starts with '_', then it is ok, else compare
                     // the string to make sure it isn't the same and we don't end up
                     // with duplicate entries
-                    if (name != mangled_cstr && ((mangled_cstr[0] == '_') || (::strcmp(name, mangled_cstr) != 0)))
+                    if (name && name != mangled_cstr && ((mangled_cstr[0] == '_') || (::strcmp(name, mangled_cstr) != 0)))
                     {
                         Mangled mangled (ConstString(mangled_cstr), true);
                         func_fullnames.Insert (mangled.GetMangledName(), DIERef(cu_offset, die.GetOffset()));




More information about the lldb-commits mailing list