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
This commit is contained in:
jimblandy 2010-08-25 15:11:15 +00:00
parent 42943c2391
commit c2c4192c1b

View File

@ -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);