aboutsummaryrefslogtreecommitdiff
path: root/src/common/dwarf_cu_to_module.cc
diff options
context:
space:
mode:
authorerikchen@chromium.org <erikchen@chromium.org>2015-01-26 23:19:04 +0000
committererikchen@chromium.org <erikchen@chromium.org>2015-01-26 23:19:04 +0000
commitefa0310455b916ca69f1c42033254932dd3ea084 (patch)
treee2d8a62e91b1972f629e352e62ba3ab564ba1a9f /src/common/dwarf_cu_to_module.cc
parentFix the scope on the initialization of kMicrodumpOnConsole to match header. (diff)
downloadbreakpad-efa0310455b916ca69f1c42033254932dd3ea084.tar.xz
Fix a source of memory corruption.
This error was causing crashes in official Chrome Mac builds on 10.8.5 machines. BUG=chromium:449214 R=mark@chromium.org git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1414 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/common/dwarf_cu_to_module.cc')
-rw-r--r--src/common/dwarf_cu_to_module.cc20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/common/dwarf_cu_to_module.cc b/src/common/dwarf_cu_to_module.cc
index 444e9a94..4bd7bdd5 100644
--- a/src/common/dwarf_cu_to_module.cc
+++ b/src/common/dwarf_cu_to_module.cc
@@ -396,6 +396,18 @@ string DwarfCUToModule::GenericDIEHandler::ComputeQualifiedName() {
enclosing_name = &parent_context_->name;
}
+ // Prepare the return value before upcoming mutations possibly invalidate the
+ // existing pointers.
+ string return_value;
+ if (qualified_name) {
+ return_value = *qualified_name;
+ } else {
+ // Combine the enclosing name and unqualified name to produce our
+ // own fully-qualified name.
+ return_value = cu_context_->language->MakeQualifiedName(*enclosing_name,
+ *unqualified_name);
+ }
+
// If this DIE was marked as a declaration, record its names in the
// specification table.
if (declaration_) {
@@ -409,13 +421,7 @@ string DwarfCUToModule::GenericDIEHandler::ComputeQualifiedName() {
cu_context_->file_context->file_private_->specifications[offset_] = spec;
}
- if (qualified_name)
- return *qualified_name;
-
- // Combine the enclosing name and unqualified name to produce our
- // own fully-qualified name.
- return cu_context_->language->MakeQualifiedName(*enclosing_name,
- *unqualified_name);
+ return return_value;
}
// A handler class for DW_TAG_subprogram DIEs.