Skip ELF notes with a p_vaddr of zero

Don't attempt to read data if the note isn't in an allocated segment.
See investigation starting at
https://bugs.chromium.org/p/crashpad/issues/detail?id=220#c27 for
details.

Bug: crashpad:220, crashpad:30, crashpad:196
Change-Id: I60eaacb83ad00ef33bde9079d25cc23a59bdf2c8
Reviewed-on: https://chromium-review.googlesource.com/941507
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
This commit is contained in:
Scott Graham 2018-02-28 13:15:49 -08:00 committed by Commit Bot
parent 493e29bc3d
commit a45e88602b

View File

@ -164,7 +164,7 @@ class ElfImageReader::ProgramHeaderTableSpecific
VMSize* size) const override {
INITIALIZATION_STATE_DCHECK_VALID(initialized_);
for (size_t index = *start_index; index < table_.size(); ++index) {
if (table_[index].p_type == PT_NOTE) {
if (table_[index].p_type == PT_NOTE && table_[index].p_vaddr != 0) {
*start_index = index + 1;
*address = table_[index].p_vaddr;
*size = table_[index].p_memsz;