1
0
mirror of https://github.com/upx/upx synced 2025-09-28 19:06:07 +08:00

Guard against empty PT_NOTE

https://github.com/upx/upx/issues/817
	modified:   p_lx_elf.cpp
This commit is contained in:
John Reiser 2024-05-01 10:09:52 -07:00 committed by Markus F.X.J. Oberhumer
parent 92c925fe95
commit 0e6cef99a0

View File

@ -3984,8 +3984,8 @@ void PackLinuxElf32::pack1(OutputFile * /*fo*/, Filter &ft)
phdr = phdri;
for (unsigned j=0; j < e_phnum; ++phdr, ++j) {
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->readx(&note_body[note_size], len);
note_size += up4(len);