summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/lit/SymbolFile/DWARF/debug-names-compressed.cpp14
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h1
2 files changed, 15 insertions, 0 deletions
diff --git a/lldb/lit/SymbolFile/DWARF/debug-names-compressed.cpp b/lldb/lit/SymbolFile/DWARF/debug-names-compressed.cpp
new file mode 100644
index 00000000000..076cac19252
--- /dev/null
+++ b/lldb/lit/SymbolFile/DWARF/debug-names-compressed.cpp
@@ -0,0 +1,14 @@
+// Test for a bug where we crashed while processing a compressed debug_names
+// section (use after free).
+
+// REQUIRES: lld, zlib
+
+// RUN: clang -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf %s
+// RUN: ld.lld %t.o -o %t --compress-debug-sections=zlib
+// RUN: lldb-test symbols --find=variable --name=foo %t | FileCheck %s
+
+// CHECK: Found 1 variables:
+int foo;
+// ONE-DAG: name = "foo", type = {{.*}} (int), {{.*}} decl = debug-names-compressed.cpp:[[@LINE-1]]
+
+extern "C" void _start() {}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
index 4f0b1cee420..ad964e51cfc 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
@@ -53,6 +53,7 @@ private:
DWARFDataExtractor debug_str_data,
DWARFDebugInfo &debug_info)
: DWARFIndex(module), m_debug_info(debug_info),
+ m_debug_names_data(debug_names_data), m_debug_str_data(debug_str_data),
m_debug_names_up(std::move(debug_names_up)),
m_fallback(module, &debug_info, GetUnits(*m_debug_names_up)) {}
OpenPOWER on IntegriCloud