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:
+2
-1
@@ -1645,7 +1645,8 @@ tribool PackMachBase<T>::canUnpack()
|
|||||||
|
|
||||||
unsigned const ncmds = mhdri.ncmds;
|
unsigned const ncmds = mhdri.ncmds;
|
||||||
int headway = (int)mhdri.sizeofcmds;
|
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),
|
char msg[80]; snprintf(msg, sizeof(msg),
|
||||||
"bad Mach_header ncmds=%d sizeofcmds=0x%x", ncmds, headway);
|
"bad Mach_header ncmds=%d sizeofcmds=0x%x", ncmds, headway);
|
||||||
throwCantUnpack(msg);
|
throwCantUnpack(msg);
|
||||||
|
|||||||
Reference in New Issue
Block a user