Check ph.method in PackMachBase::unpack
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=65553 https://github.com/upx/upx/issues/766 modified: p_mach.cpp
This commit is contained in:
committed by
Markus F.X.J. Oberhumer
parent
b87f60a917
commit
f3728d99b9
@@ -1512,6 +1512,9 @@ void PackMachBase<T>::unpack(OutputFile *fo)
|
|||||||
if ((unsigned)file_size < ph.c_len || ph.c_len == 0 || ph.u_len == 0)
|
if ((unsigned)file_size < ph.c_len || ph.c_len == 0 || ph.u_len == 0)
|
||||||
throwCantUnpack("file header corrupted");
|
throwCantUnpack("file header corrupted");
|
||||||
ph.method = bhdr.b_method;
|
ph.method = bhdr.b_method;
|
||||||
|
if (ph.method < M_NRV2B_LE32
|
||||||
|
|| ph.method > M_BZIP2)
|
||||||
|
throwCantUnpack("file header bad method");
|
||||||
ph.filter = bhdr.b_ftid;
|
ph.filter = bhdr.b_ftid;
|
||||||
ph.filter_cto = bhdr.b_cto8;
|
ph.filter_cto = bhdr.b_cto8;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user