Final ph.u_len and ph.c_len reflect multiple compressed extents

https://github.com/upx/upx/issues/655
	modified:   ../.github/travis_testsuite_1-expected_sha256sums.sh
	modified:   p_lx_elf.cpp
This commit is contained in:
John Reiser
2023-03-06 10:22:35 -08:00
parent adb0ca8250
commit 96c196b1be
2 changed files with 74 additions and 70 deletions
+4
View File
@@ -5411,6 +5411,10 @@ void PackLinuxElf32::pack4(OutputFile *fo, Filter &ft)
// But strict SELinux (or PaX, grSecurity) disallows PF_W with PF_X.
set_te32(&elfout.phdr[C_TEXT].p_filesz, sz_pack2 + lsize);
elfout.phdr[C_TEXT].p_memsz = elfout.phdr[C_TEXT].p_filesz;
// ph.u_len and ph.c_len are leftover from earliest days when there was
// only one compressed extent. Use a good analogy for multiple extents.
ph.u_len = file_size;
ph.c_len = total_out;
super::pack4(fo, ft); // write PackHeader and overlay_offset
fo->seek(0, SEEK_SET);