Ignore malformed ElfXX_Shdr in search for .text or .note

https://github.com/upx/upx/issues/287
	modified:   p_vmlinx.cpp
This commit is contained in:
John Reiser 2019-07-21 07:40:21 -07:00
parent 23570097cf
commit 276b748aa6

View File

@ -577,6 +577,7 @@ int PackVmlinuxBase<T>::canUnpack()
Shdr *p;
for (p= shdri, j= ehdri.e_shnum; --j>=0; ++p) {
if ((unsigned)file_size < (p->sh_size + p->sh_offset)
|| (5+ p->sh_name) < p->sh_name // wrap: ignore malformed
|| shstrsec->sh_size < (5+ p->sh_name) ) {
continue;
}