1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

One more additional error check for invalid Mach-O files for a

load command that use the MachO:: linkedit_data_command
type but is not used in llvm libObject code but used in llvm tool code.

This is for the LC_CODE_SIGNATURE load command.

llvm-svn: 284529
This commit is contained in:
Kevin Enderby 2016-10-18 20:24:12 +00:00
parent 03bf1de126
commit e0896cb3d9
3 changed files with 8 additions and 0 deletions

View File

@ -833,6 +833,7 @@ MachOObjectFile::MachOObjectFile(MemoryBufferRef Object, bool IsLittleEndian,
const char *FuncStartsLoadCmd = nullptr;
const char *SplitInfoLoadCmd = nullptr;
const char *CodeSignDrsLoadCmd = nullptr;
const char *CodeSignLoadCmd = nullptr;
const char *VersLoadCmd = nullptr;
const char *SourceLoadCmd = nullptr;
const char *EntryPointLoadCmd = nullptr;
@ -885,6 +886,10 @@ MachOObjectFile::MachOObjectFile(MemoryBufferRef Object, bool IsLittleEndian,
if ((Err = checkLinkeditDataCommand(this, Load, I, &CodeSignDrsLoadCmd,
"LC_DYLIB_CODE_SIGN_DRS")))
return;
} else if (Load.C.cmd == MachO::LC_CODE_SIGNATURE) {
if ((Err = checkLinkeditDataCommand(this, Load, I, &CodeSignLoadCmd,
"LC_CODE_SIGNATURE")))
return;
} else if (Load.C.cmd == MachO::LC_DYLD_INFO) {
if ((Err = checkDyldInfoCommand(this, Load, I, &DyldInfoLoadCmd,
"LC_DYLD_INFO")))

Binary file not shown.

View File

@ -373,3 +373,6 @@ INVALID-ROUTINES-BAD-SIZE: macho-invalid-routines-bad-size': truncated or malfor
RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho-invalid-routines64-more-than-one 2>&1 | FileCheck -check-prefix INVALID-ROUTINES64-MORE-THAN-ONE %s
INVALID-ROUTINES64-MORE-THAN-ONE: macho-invalid-routines64-more-than-one': truncated or malformed object (more than one LC_ROUTINES_64 and or LC_ROUTINES command)
RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho-invalid-codesign-bad-size 2>&1 | FileCheck -check-prefix INVALID-CODESIGN-BAD-SIZE %s
INVALID-CODESIGN-BAD-SIZE: macho-invalid-codesign-bad-size': truncated or malformed object (LC_CODE_SIGNATURE command 0 has incorrect cmdsize)