Detect "no Shdrs" earlier when already packed
https://github.com/upx/upx/issues/699 modified: p_lx_elf.cpp
This commit is contained in:
parent
59c6a71b72
commit
b526eed346
@ -1046,12 +1046,15 @@ PackLinuxElf64::PackLinuxElf64help1(InputFile *f)
|
|||||||
if (!(opt->cmd == CMD_COMPRESS && e_shoff < (upx_uint64_t)file_size && mb_shdr.getSize() == 0)) {
|
if (!(opt->cmd == CMD_COMPRESS && e_shoff < (upx_uint64_t)file_size && mb_shdr.getSize() == 0)) {
|
||||||
shdri = nullptr;
|
shdri = nullptr;
|
||||||
}
|
}
|
||||||
else {
|
else if (e_shnum && e_shoff && ehdri.e_shentsize) {
|
||||||
fi->seek(e_shoff, SEEK_SET);
|
fi->seek(e_shoff, SEEK_SET);
|
||||||
mb_shdr.alloc( sizeof(Elf64_Shdr) * e_shnum);
|
mb_shdr.alloc( sizeof(Elf64_Shdr) * e_shnum);
|
||||||
shdri = (Elf64_Shdr *)mb_shdr.getVoidPtr();
|
shdri = (Elf64_Shdr *)mb_shdr.getVoidPtr();
|
||||||
fi->readx(shdri, sizeof(Elf64_Shdr) * e_shnum);
|
fi->readx(shdri, sizeof(Elf64_Shdr) * e_shnum);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
shdri = nullptr;
|
||||||
|
}
|
||||||
sec_dynsym = elf_find_section_type(Elf64_Shdr::SHT_DYNSYM);
|
sec_dynsym = elf_find_section_type(Elf64_Shdr::SHT_DYNSYM);
|
||||||
if (sec_dynsym) {
|
if (sec_dynsym) {
|
||||||
unsigned t = get_te32(&sec_dynsym->sh_link);
|
unsigned t = get_te32(&sec_dynsym->sh_link);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user