mirror of https://github.com/upx/upx.git
p_vmlinx was too eager
https://github.com/upx/upx/issues/622 modified: src/p_vmlinx.cpp
This commit is contained in:
parent
5045f7eb42
commit
82d26f04a4
|
@ -108,7 +108,8 @@ typename T::Shdr const *PackVmlinuxBase<T>::getElfSections()
|
||||||
if (ehdri.e_shentsize != sizeof(*shdri)
|
if (ehdri.e_shentsize != sizeof(*shdri)
|
||||||
|| file_size_u < ehdri.e_shoff
|
|| file_size_u < ehdri.e_shoff
|
||||||
|| file_size_u < ehdri.e_shoff + mem_size(ehdri.e_shentsize, e_shnum)) {
|
|| 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];
|
shdri = new Shdr[(unsigned) e_shnum];
|
||||||
fi->seek(ehdri.e_shoff, SEEK_SET);
|
fi->seek(ehdri.e_shoff, SEEK_SET);
|
||||||
|
@ -117,7 +118,8 @@ typename T::Shdr const *PackVmlinuxBase<T>::getElfSections()
|
||||||
if (e_shnum <= e_shstrndx) {
|
if (e_shnum <= e_shstrndx) {
|
||||||
char msg[50]; snprintf(msg, sizeof(msg),
|
char msg[50]; snprintf(msg, sizeof(msg),
|
||||||
"bad .e_shstrndx %#x", e_shstrndx);
|
"bad .e_shstrndx %#x", e_shstrndx);
|
||||||
throwCantPack(msg);
|
infoWarning(msg);
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
Shdr const *p = &shdri[e_shstrndx];
|
Shdr const *p = &shdri[e_shstrndx];
|
||||||
if (Shdr::SHT_STRTAB==p->sh_type
|
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) {
|
if (p->sh_size <= p->sh_name) {
|
||||||
char msg[50]; snprintf(msg, sizeof(msg),
|
char msg[50]; snprintf(msg, sizeof(msg),
|
||||||
"bad .shstrtab _Shdr[%u]", (unsigned)ehdri.e_shstrndx);
|
"bad .shstrtab _Shdr[%u]", (unsigned)ehdri.e_shstrndx);
|
||||||
throwCantPack(msg);
|
infoWarning(msg);
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
shstrtab = new char[1+ p->sh_size];
|
shstrtab = new char[1+ p->sh_size];
|
||||||
fi->seek(p->sh_offset, SEEK_SET);
|
fi->seek(p->sh_offset, SEEK_SET);
|
||||||
|
|
Loading…
Reference in New Issue