PT_LOAD[0] with ElfXX.Ehdr only

https://github.com/upx/upx/issues/283
	modified:   p_lx_elf.cpp
This commit is contained in:
John Reiser
2019-07-14 13:08:56 -07:00
parent c33603e324
commit 593a69ce25
+14
View File
@@ -3842,9 +3842,16 @@ int PackLinuxElf32::pack2(OutputFile *fo, Filter &ft)
if (ft.id < 0x40) { if (ft.id < 0x40) {
// FIXME: ?? ft.addvalue += asl_delta; // FIXME: ?? ft.addvalue += asl_delta;
} }
if (delta == x.size) { // PT_LOAD[0] with ElfXX.Ehdr only
// QBE backend - http://c9x.me/compile/
hdr_u_len = 0; // no fiddling necessary!
// &ft arg to packExtent will be zero becaue (k != nk_f)
}
else {
x.offset += delta; x.offset += delta;
x.size -= delta; x.size -= delta;
} }
}
// compressWithFilters() always assumes a "loader", so would // compressWithFilters() always assumes a "loader", so would
// throw NotCompressible for small .data Extents, which PowerPC // throw NotCompressible for small .data Extents, which PowerPC
// sometimes marks as PF_X anyway. So filter only first segment. // sometimes marks as PF_X anyway. So filter only first segment.
@@ -3966,9 +3973,16 @@ int PackLinuxElf64::pack2(OutputFile *fo, Filter &ft)
if (ft.id < 0x40) { if (ft.id < 0x40) {
// FIXME: ?? ft.addvalue += asl_delta; // FIXME: ?? ft.addvalue += asl_delta;
} }
if (delta == x.size) { // PT_LOAD[0] with ElfXX.Ehdr only
// QBE backend - http://c9x.me/compile/
hdr_u_len = 0; // no fiddling necessary!
// &ft arg to packExtent will be zero becaue (k != nk_f)
}
else {
x.offset += delta; x.offset += delta;
x.size -= delta; x.size -= delta;
} }
}
// compressWithFilters() always assumes a "loader", so would // compressWithFilters() always assumes a "loader", so would
// throw NotCompressible for small .data Extents, which PowerPC // throw NotCompressible for small .data Extents, which PowerPC
// sometimes marks as PF_X anyway. So filter only first segment. // sometimes marks as PF_X anyway. So filter only first segment.