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:
John Reiser 2024-01-10 16:04:08 -08:00 committed by Markus F.X.J. Oberhumer
parent b87f60a917
commit f3728d99b9

View File

@ -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)
throwCantUnpack("file header corrupted");
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_cto = bhdr.b_cto8;