linux: skip zero length mappings in the maps file

A zero-length mapping was observed for a x86 process running on an
x86_64 Android Lollipop (5.0) simulator:

ff3c0000-ff3c0000 ---p 00000000 00:00 0
ff3c0000-ffbbf000 rw-p 00000000 00:00 0  [stack]
ffffe000-fffff000 r-xp 00000000 00:00 0  [vdso]

Bug: crashpad:30
Change-Id: I1c1cb5a0910ddf3f02a93d44803e17bec4071110
Reviewed-on: https://chromium-review.googlesource.com/999112
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
This commit is contained in:
Joshua Peraza 2018-04-05 18:40:53 -07:00 committed by Commit Bot
parent 3a20d34ac3
commit 1bb4c233e3

View File

@ -102,10 +102,20 @@ ParseResult ParseMapsLine(DelimitedFileReader* maps_file_reader,
LOG(ERROR) << "format error";
return ParseResult::kError;
}
if (end_address <= start_address) {
if (end_address < start_address) {
LOG(ERROR) << "format error";
return ParseResult::kError;
}
// Skip zero-length mappings.
if (end_address == start_address) {
std::string rest_of_line;
if (maps_file_reader->GetLine(&rest_of_line) !=
DelimitedFileReader::Result::kSuccess) {
LOG(ERROR) << "format error";
return ParseResult::kError;
}
return ParseResult::kSuccess;
}
// TODO(jperaza): set bitness properly
#if defined(ARCH_CPU_64_BITS)