Validate input LC_ commands in order to defend against fuzzers

TODO: validate in ::unpack(), too
https://github.com/upx/upx/issues/545
	modified:   p_mach.cpp
	modified:   p_mach.h
	modified:   p_mach_enum.h
This commit is contained in:
John Reiser
2021-12-26 19:40:34 -08:00
committed by Markus F.X.J. Oberhumer
parent 5bcf9dd8af
commit 4a9c46253e
3 changed files with 212 additions and 20 deletions
+2
View File
@@ -81,6 +81,7 @@
LC_LOAD_DYLIB = 0xc,
LC_ID_DYLIB = 0xd,
LC_LOAD_DYLINKER = 0xe,
LC_ID_DYLINKER = 0xf,
LC_ROUTINES = 0x11,
LC_TWOLEVEL_HINTS= 0x16,
LC_LOAD_WEAK_DYLIB= (0x18 | LC_REQ_DYLD),
@@ -106,6 +107,7 @@
LC_ENCRYPTION_INFO_64= 0x2C,
LC_VERSION_MIN_TVOS= 0x2F,
LC_VERSION_MIN_WATCHOS= 0x30,
LC_NOTE = 0x31,
};
enum { // maxprot