Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(966)

Unified Diff: snapshot/mac/mach_o_image_reader.cc

Issue 1019243006: Tolerate weird cl_kernels modules (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Check the Mach-O file type too Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « snapshot/mac/mach_o_image_reader.h ('k') | snapshot/mac/mach_o_image_segment_reader.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: snapshot/mac/mach_o_image_reader.cc
diff --git a/snapshot/mac/mach_o_image_reader.cc b/snapshot/mac/mach_o_image_reader.cc
index 0f791e1b8ed43574921299d65ec6d2ed7ac6b673..f9da354da81ffee01bd150bcd9d7f00b71b18b11 100644
--- a/snapshot/mac/mach_o_image_reader.cc
+++ b/snapshot/mac/mach_o_image_reader.cc
@@ -40,6 +40,7 @@ namespace crashpad {
MachOImageReader::MachOImageReader()
: segments_(),
segment_map_(),
+ module_name_(),
module_info_(),
dylinker_name_(),
uuid_(),
@@ -67,6 +68,7 @@ bool MachOImageReader::Initialize(ProcessReader* process_reader,
process_reader_ = process_reader;
address_ = address;
+ module_name_ = name;
module_info_ =
base::StringPrintf(", module %s, address 0x%llx", name.c_str(), address);
@@ -85,7 +87,19 @@ bool MachOImageReader::Initialize(ProcessReader* process_reader,
return false;
}
- file_type_ = mach_header.filetype;
+ switch (mach_header.filetype) {
+ case MH_EXECUTE:
+ case MH_DYLIB:
+ case MH_DYLINKER:
+ case MH_BUNDLE:
+ file_type_ = mach_header.filetype;
+ break;
+ default:
+ LOG(WARNING) << base::StringPrintf(
+ "unexpected mach_header::filetype 0x%08x",
+ mach_header.filetype) << module_info_;
+ return false;
+ }
const uint32_t kExpectedSegmentCommand =
is_64_bit ? LC_SEGMENT_64 : LC_SEGMENT;
@@ -510,8 +524,11 @@ bool MachOImageReader::ReadSegmentCommand(
size_t segment_index = segments_.size();
segments_.push_back(segment); // Takes ownership.
- if (!segment->Initialize(
- process_reader_, load_command_address, load_command_info)) {
+ if (!segment->Initialize(process_reader_,
+ load_command_address,
+ load_command_info,
+ module_name_,
+ file_type_)) {
segments_.pop_back();
return false;
}
« no previous file with comments | « snapshot/mac/mach_o_image_reader.h ('k') | snapshot/mac/mach_o_image_segment_reader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698