From c2c4192c1bc951512073c6108e63e2c6d08da639 Mon Sep 17 00:00:00 2001 From: jimblandy Date: Wed, 25 Aug 2010 15:11:15 +0000 Subject: [PATCH] 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 --- src/common/dwarf/dwarf2reader.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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);