OcMachoLib: Drop the "minimal LC size" check.

It is implicitly covered by the checks below and worsens performance of valid binaries in favor of increasing it for invalid ones.
This commit is contained in:
Download-Fritz 2018-10-21 11:58:21 +02:00
parent a5f7f6bed9
commit b74e10e066

View File

@ -51,7 +51,6 @@ MachoInitializeContext (
OUT VOID *Context
)
{
UINTN MinCommandsSize;
UINTN TopOfCommands;
UINTN Index;
CONST MACH_LOAD_COMMAND *Command;
@ -64,11 +63,9 @@ MachoInitializeContext (
//
// Verify Mach-O Header sanity.
//
TopOfCommands = ((UINTN)MachHeader->Commands + MachHeader->CommandsSize);
MinCommandsSize = (MachHeader->NumCommands * sizeof (*MachHeader->Commands));
TopOfCommands = ((UINTN)MachHeader->Commands + MachHeader->CommandsSize);
if ((FileSize < sizeof (*MachHeader))
|| (MachHeader->Signature != MACH_HEADER_64_SIGNATURE)
|| (MachHeader->CommandsSize < MinCommandsSize)
|| (TopOfCommands > ((UINTN)MachHeader + FileSize))) {
return FALSE;
}