Detect Mach_header.sizeofcmds==0
https://github.com/upx/upx/issues/448 modified: p_mach.cpp
This commit is contained in:
parent
c9fe84c9aa
commit
80de11bc5b
@ -1811,8 +1811,9 @@ bool PackMachBase<T>::canPack()
|
|||||||
char buf[32]; snprintf(buf, sizeof(buf), "bad sizeofcmds %d", sz_mhcmds);
|
char buf[32]; snprintf(buf, sizeof(buf), "bad sizeofcmds %d", sz_mhcmds);
|
||||||
throwCantPack(buf);
|
throwCantPack(buf);
|
||||||
}
|
}
|
||||||
if (16384 < sz_mhcmds) { // somewhat arbitrary, but amd64-darwin.macho-upxmain.c
|
if (!sz_mhcmds
|
||||||
throwCantPack("16384 < Mach_header.sizeofcmds");
|
|| 16384 < sz_mhcmds) { // somewhat arbitrary, but amd64-darwin.macho-upxmain.c
|
||||||
|
throwCantPack("16384 < Mach_header.sizeofcmds (or ==0)");
|
||||||
}
|
}
|
||||||
rawmseg_buf.alloc(sz_mhcmds);
|
rawmseg_buf.alloc(sz_mhcmds);
|
||||||
rawmseg = (Mach_segment_command *)(void *)rawmseg_buf;
|
rawmseg = (Mach_segment_command *)(void *)rawmseg_buf;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user