Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(772)

Issue 595002: Fix ELF build ID getter to check the ELF note's namespace string

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 7 months ago by mseaborn
Modified:
11 years, 7 months ago
Reviewers:
Mark Mentovai
CC:
google-breakpad-dev_googlegroups.com
Base URL:
http://google-breakpad.googlecode.com/svn/trunk
Visibility:
Public.

Description

Fix ELF build ID getter to check the ELF note's namespace string

Otherwise n_type might match a note ID value for a namespace other than
"GNU".

Also add some pedantic bounds checks.

BUG=none
TEST=FileIDTest

Patch Set 1 #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats Patch
M src/common/linux/elf_gnu_compat.h View 1 chunk +5 lines, -0 lines 0 comments Download
M src/common/linux/file_id.cc View 1 chunk +13 lines, -6 lines 3 comments Download
M src/common/linux/file_id_unittest.cc View 2 chunks +5 lines, -0 lines 0 comments Download

Messages

Total messages: 2
mseaborn
I noticed this because Roland pointed out I wasn't checking this in some NaCl code ...
11 years, 7 months ago #1
Mark Mentovai
11 years, 7 months ago #2
LGTM

https://breakpad.appspot.com/595002/diff/1/src/common/linux/file_id.cc
File src/common/linux/file_id.cc (right):

https://breakpad.appspot.com/595002/diff/1/src/common/linux/file_id.cc#newcode68
src/common/linux/file_id.cc:68: while (reinterpret_cast<const
void*>(note_header) < section_end) {
I wish this whole section wasn’t so casty. Oh well.

https://breakpad.appspot.com/595002/diff/1/src/common/linux/file_id.cc#newcode75
src/common/linux/file_id.cc:75: if (reinterpret_cast<const void*>(note_end) >
section_end)
I don’t know if you need to check both name_field and note_end against
section_end. You can maybe get away with dumping the check on line 70, unless
you’re worried about overflow.

https://breakpad.appspot.com/595002/diff/1/src/common/linux/file_id.cc#newcode80
src/common/linux/file_id.cc:80: break;
{} this because the condition’s already taken up so many lines.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld 1004:630ec63f810e-tainted