Fix usage of _te32/_te64/_te16 for Elf classes
How did it ever work? UPX_RSIZE_MAX_MEM of 768MiB, Elf32_Off of only 32-bits, and preponderance of little-endian and small positive integers hides many mis-uses of _te64/_te32. ELF does not help: e_phnum, e_shnum, Elf32_Section, Elf64_Section are all 16-bit, but sh_info and sh_link are 32-bit. Templatizing p_elf.h (following the example of p_mach.h) failed because of complexity. (Plus too many special cases of ELF where 32-bit and 64-bit are not parallel.) modified: p_lx_elf.cpp modified: p_lx_sh.cpp modified: p_mach.cpp
This commit is contained in:
+1
-1
@@ -1838,7 +1838,7 @@ int PackMachBase<T>::canUnpack()
|
||||
&& (Mach_header::MH_MAGIC + (sizeof(Addr)>>3)) == uptr[1]) {
|
||||
return true;
|
||||
}
|
||||
unsigned const magic = get_te32(1+ (char const *)uptr);
|
||||
unsigned const magic = get_te32(&uptr[1]); // FIXME: probable bug
|
||||
if ((M_NRV2B_8 == method || M_NRV2E_8 == method)
|
||||
&& 0xfc==(0xfc & uptr[0])
|
||||
&& (Mach_header::MH_MAGIC + (sizeof(Addr)>>3)) == magic) {
|
||||
|
||||
Reference in New Issue
Block a user