mirror of
https://github.com/upx/upx
synced 2025-09-28 19:06:07 +08:00
At ::unpack much of decompressed Mach_header must match outer Mach_header
This commit is contained in:
parent
cdd152d015
commit
cb35ba4543
|
@ -1304,6 +1304,11 @@ void PackMachBase<T>::unpack(OutputFile *fo)
|
|||
fi->readx(ibuf, ph.c_len);
|
||||
Mach_header *const mhdr = (Mach_header *)new upx_byte[ph.u_len];
|
||||
decompress(ibuf, (upx_byte *)mhdr, false);
|
||||
if (mhdri.magic != mhdr->magic
|
||||
|| mhdri.cputype != mhdr->cputype
|
||||
|| mhdri.cpusubtype != mhdr->cpusubtype
|
||||
|| mhdri.filetype != mhdr->filetype)
|
||||
throwCantUnpack("file header corrupted");
|
||||
unsigned const ncmds = mhdr->ncmds;
|
||||
|
||||
msegcmd = new Mach_segment_command[ncmds];
|
||||
|
|
|
@ -71,7 +71,7 @@ __packed_struct(Mach_header)
|
|||
|
||||
Word magic;
|
||||
Word cputype;
|
||||
Word cpysubtype;
|
||||
Word cpusubtype;
|
||||
Word filetype;
|
||||
Word ncmds;
|
||||
Word sizeofcmds;
|
||||
|
@ -87,7 +87,7 @@ __packed_struct(Mach_header64)
|
|||
|
||||
Word magic;
|
||||
Word cputype;
|
||||
Word cpysubtype;
|
||||
Word cpusubtype;
|
||||
Word filetype;
|
||||
Word ncmds;
|
||||
Word sizeofcmds;
|
||||
|
|
Loading…
Reference in New Issue
Block a user