Fix de-compression of ELF shared libraries

Reset ph.method on each b_info.b_method.
Use file_image[] as ReadOnly, subsuming fi->seek()+read().
Use lowmem[0, +xct_off) for changing values.
Work on un_DT_INIT().
https://github.com/upx/upx/issues/882

	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
	modified:   p_unix.cpp
This commit is contained in:
John Reiser
2025-02-15 19:35:21 -08:00
committed by Markus F.X.J. Oberhumer
parent eff1ef2d70
commit 78f4959521
3 changed files with 46 additions and 75 deletions
+2
View File
@@ -485,6 +485,7 @@ unsigned PackUnix::unpackExtent(unsigned wanted, OutputFile *fo,
fi->readx(&hdr, szb_info);
int const sz_unc = ph.u_len = get_te32(&hdr.sz_unc);
int const sz_cpr = ph.c_len = get_te32(&hdr.sz_cpr);
ph.method = hdr.b_method;
ph.filter_cto = hdr.b_cto8;
if (sz_unc == 0 || M_LZMA < hdr.b_method) {
@@ -657,6 +658,7 @@ void PackUnix::unpack(OutputFile *fo)
fi->readx(&bhdr, szb_info);
ph.u_len = sz_unc = get_te32(&bhdr.sz_unc);
ph.c_len = sz_cpr = get_te32(&bhdr.sz_cpr);
ph.method = bhdr.b_method;
if (sz_unc == 0) // uncompressed size 0 -> EOF
{