[Lldb-commits] [lldb] r247571 - Fix a possible SEGV in SymbolFileDWARF

Tamas Berghammer via lldb-commits lldb-commits at lists.llvm.org
Mon Sep 14 08:44:29 PDT 2015


Author: tberghammer
Date: Mon Sep 14 10:44:29 2015
New Revision: 247571

URL: http://llvm.org/viewvc/llvm-project?rev=247571&view=rev
Log:
Fix a possible SEGV in SymbolFileDWARF

The iterator pointing to an element of a dense map was used after
the element from was removed from the map what isn't guaranteed to be
valid at that time.

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

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=247571&r1=247570&r2=247571&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Mon Sep 14 10:44:29 2015
@@ -1513,15 +1513,16 @@ SymbolFileDWARF::CompleteType (CompilerT
         // We have already resolved this type...
         return true;
     }
+
+    DWARFDebugInfo* debug_info = DebugInfo();
+    DWARFDIE dwarf_die = debug_info->GetDIE(die_it->getSecond());
+
     // Once we start resolving this type, remove it from the forward declaration
     // map in case anyone child members or other types require this type to get resolved.
     // The type will get resolved when all of the calls to SymbolFileDWARF::ResolveClangOpaqueTypeDefinition
     // are done.
-    GetForwardDeclClangTypeToDie().erase (clang_type_no_qualifiers.GetOpaqueQualType());
+    GetForwardDeclClangTypeToDie().erase (die_it);
 
-    DWARFDebugInfo* debug_info = DebugInfo();
-    
-    DWARFDIE dwarf_die = debug_info->GetDIE(die_it->getSecond());
     Type *type = GetDIEToType().lookup (dwarf_die.GetDIE());
 
     Log *log (LogChannelDWARF::GetLogIfAny(DWARF_LOG_DEBUG_INFO|DWARF_LOG_TYPE_COMPLETION));




More information about the lldb-commits mailing list