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