mirror of
https://github.com/upx/upx
synced 2025-09-28 19:06:07 +08:00
Unpacking ELF requires e_phnum at least 2
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=65535 https://github.com/upx/upx/issues/763 modified: p_lx_elf.cpp
This commit is contained in:
parent
d549c2b5c9
commit
d3e780d617
|
@ -2420,6 +2420,9 @@ tribool PackLinuxElf32::canUnpack() // bool, except -1: format known, but not pa
|
|||
if (checkEhdr(&ehdri)) {
|
||||
return false;
|
||||
}
|
||||
if (get_te16(&ehdri.e_phnum) < 2) {
|
||||
throwCantUnpack("e_phnum must be >= 2");
|
||||
}
|
||||
if (Elf32_Ehdr::ET_DYN==get_te16(&ehdri.e_type)) {
|
||||
PackLinuxElf32help1(fi);
|
||||
}
|
||||
|
@ -2966,6 +2969,9 @@ tribool PackLinuxElf64::canUnpack() // bool, except -1: format known, but not pa
|
|||
if (checkEhdr(&ehdri)) {
|
||||
return false;
|
||||
}
|
||||
if (get_te16(&ehdri.e_phnum) < 2) {
|
||||
throwCantUnpack("e_phnum must be >= 2");
|
||||
}
|
||||
if (Elf64_Ehdr::ET_DYN==get_te16(&ehdri.e_type)) {
|
||||
PackLinuxElf64help1(fi);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user