Guard against empty PT_NOTE
https://github.com/upx/upx/issues/817 modified: p_lx_elf.cpp
This commit is contained in:
committed by
Markus F.X.J. Oberhumer
parent
92c925fe95
commit
0e6cef99a0
+2
-2
@@ -3984,8 +3984,8 @@ void PackLinuxElf32::pack1(OutputFile * /*fo*/, Filter &ft)
|
|||||||
phdr = phdri;
|
phdr = phdri;
|
||||||
for (unsigned j=0; j < e_phnum; ++phdr, ++j) {
|
for (unsigned j=0; j < e_phnum; ++phdr, ++j) {
|
||||||
unsigned const type = get_te32(&phdr->p_type);
|
unsigned const type = get_te32(&phdr->p_type);
|
||||||
if (PT_NOTE32 == type) {
|
unsigned const len = get_te32(&phdr->p_filesz);
|
||||||
unsigned const len = get_te32(&phdr->p_filesz);
|
if (PT_NOTE32 == type && len && note_body.getSize()) {
|
||||||
fi->seek(get_te32(&phdr->p_offset), SEEK_SET);
|
fi->seek(get_te32(&phdr->p_offset), SEEK_SET);
|
||||||
fi->readx(¬e_body[note_size], len);
|
fi->readx(¬e_body[note_size], len);
|
||||||
note_size += up4(len);
|
note_size += up4(len);
|
||||||
|
|||||||
Reference in New Issue
Block a user