mirror of
https://github.com/intel/llvm.git
synced 2026-01-16 13:35:38 +08:00
<rdar://problem/13941992>
Accept mach-o files with bad segments. Many core files are not created correctly and we should still be able to glean any information we can from them. llvm-svn: 183247
This commit is contained in:
@@ -994,8 +994,9 @@ ObjectFileMachO::ParseSections ()
|
||||
lc_segment_name,
|
||||
load_cmd.fileoff,
|
||||
m_length);
|
||||
m_sections_ap->Clear();
|
||||
return 0;
|
||||
|
||||
load_cmd.fileoff = 0;
|
||||
load_cmd.filesize = 0;
|
||||
}
|
||||
|
||||
if (load_cmd.fileoff + load_cmd.filesize > m_length)
|
||||
@@ -1006,13 +1007,14 @@ ObjectFileMachO::ParseSections ()
|
||||
// is null out the SectionList vector and if a process has been set up, dump a message
|
||||
// to stdout. The most common case here is core file debugging with a truncated file.
|
||||
const char *lc_segment_name = load_cmd.cmd == LoadCommandSegment64 ? "LC_SEGMENT_64" : "LC_SEGMENT";
|
||||
GetModule()->ReportError("is a corrupt mach-o file: load command %u %s has a fileoff + filesize (0x%" PRIx64 ") that extends beyond the end of the file (0x%" PRIx64 ")",
|
||||
GetModule()->ReportError("is a corrupt mach-o file: load command %u %s has a fileoff + filesize (0x%" PRIx64 ") that extends beyond the end of the file (0x%" PRIx64 "), the segment will be truncated",
|
||||
i,
|
||||
lc_segment_name,
|
||||
load_cmd.fileoff + load_cmd.filesize,
|
||||
m_length);
|
||||
m_sections_ap->Clear();
|
||||
return 0;
|
||||
|
||||
// Tuncase the length
|
||||
load_cmd.filesize = m_length - load_cmd.fileoff;
|
||||
}
|
||||
}
|
||||
if (m_data.GetU32(&offset, &load_cmd.maxprot, 4))
|
||||
|
||||
Reference in New Issue
Block a user