aboutsummaryrefslogtreecommitdiff
path: root/src/common/dwarf
diff options
context:
space:
mode:
authorjimblandy <jimblandy@4c0a9323-5329-0410-9bdc-e9ce6186880e>2010-08-25 15:11:15 +0000
committerjimblandy <jimblandy@4c0a9323-5329-0410-9bdc-e9ce6186880e>2010-08-25 15:11:15 +0000
commitc2c4192c1bc951512073c6108e63e2c6d08da639 (patch)
tree2c50ba27240e63266ec2369b4345bc103afc20e7 /src/common/dwarf
parentBreakpad DWARF parser: Don't use auto_ptr<stack<uint64> > where stack<uint64>... (diff)
downloadbreakpad-c2c4192c1bc951512073c6108e63e2c6d08da639.tar.xz
Breakpad DWARF Reader: Ignore padding at the end of the compilation unit.
After the final DIE in a compilation unit, there may be any number of zero bytes present. This is meant to allow producers to align compilation unit starting points when necessary. This patch changes the dwarf2reader::CompilationUnit class to skip those zero bytes, rather than interpreting them as 'end of children' markers for DIEs that do not exist. Without this change, the padding bytes will cause the reader to attempt to pop an offset from an empty stack, and call EndDIE with a garbage offset. a=jimblandy, r=mmentovai git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@667 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/common/dwarf')
-rw-r--r--src/common/dwarf/dwarf2reader.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/common/dwarf/dwarf2reader.cc b/src/common/dwarf/dwarf2reader.cc
index 2c15ece6..63d1ffb7 100644
--- a/src/common/dwarf/dwarf2reader.cc
+++ b/src/common/dwarf/dwarf2reader.cc
@@ -504,8 +504,12 @@ void CompilationUnit::ProcessDIEs() {
dieptr += len;
- // Abbrev == 0 represents the end of a list of children.
+ // Abbrev == 0 represents the end of a list of children, or padding
+ // at the end of the compilation unit.
if (abbrev_num == 0) {
+ if (die_stack.size() == 0)
+ // If it is padding, then we are done with the compilation unit's DIEs.
+ return;
const uint64 offset = die_stack.top();
die_stack.pop();
handler_->EndDIE(offset);