mirror of
https://github.com/upx/upx.git
synced 2024-11-23 04:39:59 +00:00
Detect sizeofcmds too small
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=66330&q=label%3AProj-upx modified: p_mach.cpp
This commit is contained in:
parent
548227a55b
commit
2ea316d754
@ -1645,7 +1645,8 @@ tribool PackMachBase<T>::canUnpack()
|
||||
|
||||
unsigned const ncmds = mhdri.ncmds;
|
||||
int headway = (int)mhdri.sizeofcmds;
|
||||
if (!ncmds || MAX_N_CMDS < ncmds || file_size < headway) {
|
||||
if (!ncmds || MAX_N_CMDS < ncmds || file_size < headway
|
||||
|| headway < 4*4 ) {
|
||||
char msg[80]; snprintf(msg, sizeof(msg),
|
||||
"bad Mach_header ncmds=%d sizeofcmds=0x%x", ncmds, headway);
|
||||
throwCantUnpack(msg);
|
||||
|
Loading…
Reference in New Issue
Block a user