aboutsummaryrefslogtreecommitdiff
path: root/src/common/stabs_to_module.cc
diff options
context:
space:
mode:
authorerikchen@chromium.org <erikchen@chromium.org>2015-01-27 01:20:59 +0000
committererikchen@chromium.org <erikchen@chromium.org>2015-01-27 01:20:59 +0000
commit7bebb27fb44920f189310985d96ed7801f59afbb (patch)
tree4488552decfc8604e6d4609ba5d56c81baa1e863 /src/common/stabs_to_module.cc
parentFix a source of memory corruption. (diff)
downloadbreakpad-7bebb27fb44920f189310985d96ed7801f59afbb.tar.xz
Fix some fragile code that is likely to cause future memory corruption
problems. - The ordering of keys in stl containers cannot change. Make the relevant members const to guarantee this assumption. - Add handling and logging for demangle errors. - Fix a potential double-delete bug if a function passed to AddFunction() is already present. BUG=chromium:449214 R=mark@chromium.org Review URL: https://breakpad.appspot.com/10704002/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1415 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/common/stabs_to_module.cc')
-rw-r--r--src/common/stabs_to_module.cc7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/common/stabs_to_module.cc b/src/common/stabs_to_module.cc
index e59aebdb..0a83cf21 100644
--- a/src/common/stabs_to_module.cc
+++ b/src/common/stabs_to_module.cc
@@ -90,9 +90,7 @@ bool StabsToModule::EndCompilationUnit(uint64_t address) {
bool StabsToModule::StartFunction(const string &name,
uint64_t address) {
assert(!current_function_);
- Module::Function *f = new Module::Function;
- f->name = Demangle(name);
- f->address = address;
+ Module::Function *f = new Module::Function(Demangle(name), address);
f->size = 0; // We compute this in StabsToModule::Finalize().
f->parameter_size = 0; // We don't provide this information.
current_function_ = f;
@@ -133,7 +131,7 @@ bool StabsToModule::Line(uint64_t address, const char *name, int number) {
}
bool StabsToModule::Extern(const string &name, uint64_t address) {
- Module::Extern *ext = new Module::Extern;
+ Module::Extern *ext = new Module::Extern(address);
// Older libstdc++ demangle implementations can crash on unexpected
// input, so be careful about what gets passed in.
if (name.compare(0, 3, "__Z") == 0) {
@@ -143,7 +141,6 @@ bool StabsToModule::Extern(const string &name, uint64_t address) {
} else {
ext->name = name;
}
- ext->address = address;
module_->AddExtern(ext);
return true;
}