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:
@@ -577,6 +577,7 @@ int PackVmlinuxBase<T>::canUnpack()
|
|||||||
Shdr *p;
|
Shdr *p;
|
||||||
for (p= shdri, j= ehdri.e_shnum; --j>=0; ++p) {
|
for (p= shdri, j= ehdri.e_shnum; --j>=0; ++p) {
|
||||||
if ((unsigned)file_size < (p->sh_size + p->sh_offset)
|
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) ) {
|
|| shstrsec->sh_size < (5+ p->sh_name) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user