p_vmlinx was too eager

https://github.com/upx/upx/issues/622
	modified:   src/p_vmlinx.cpp
This commit is contained in:
John Reiser 2022-11-08 10:30:48 -08:00 committed by Markus F.X.J. Oberhumer
parent 5045f7eb42
commit 82d26f04a4
1 changed files with 6 additions and 3 deletions

View File

@ -108,7 +108,8 @@ typename T::Shdr const *PackVmlinuxBase<T>::getElfSections()
if (ehdri.e_shentsize != sizeof(*shdri)
|| file_size_u < ehdri.e_shoff
|| file_size_u < ehdri.e_shoff + mem_size(ehdri.e_shentsize, e_shnum)) {
throwCantPack("bad ElfXX_Shdrs");
infoWarning("bad ElfXX_Shdrs");
return nullptr;
}
shdri = new Shdr[(unsigned) e_shnum];
fi->seek(ehdri.e_shoff, SEEK_SET);
@ -117,7 +118,8 @@ typename T::Shdr const *PackVmlinuxBase<T>::getElfSections()
if (e_shnum <= e_shstrndx) {
char msg[50]; snprintf(msg, sizeof(msg),
"bad .e_shstrndx %#x", e_shstrndx);
throwCantPack(msg);
infoWarning(msg);
return nullptr;
}
Shdr const *p = &shdri[e_shstrndx];
if (Shdr::SHT_STRTAB==p->sh_type
@ -130,7 +132,8 @@ typename T::Shdr const *PackVmlinuxBase<T>::getElfSections()
if (p->sh_size <= p->sh_name) {
char msg[50]; snprintf(msg, sizeof(msg),
"bad .shstrtab _Shdr[%u]", (unsigned)ehdri.e_shstrndx);
throwCantPack(msg);
infoWarning(msg);
return nullptr;
}
shstrtab = new char[1+ p->sh_size];
fi->seek(p->sh_offset, SEEK_SET);