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

fpad8() for --android-shlib in PackLinuxElf64::pack4()

https://github.com/upx/upx/issues/100
	modified:   p_lx_elf.cpp
This commit is contained in:
John Reiser 2017-05-30 11:32:05 -07:00
parent 6e541a432f
commit d979e19315

View File

@ -87,6 +87,16 @@ fpad4(OutputFile *fo)
return d + len;
}
static unsigned
fpad8(OutputFile *fo)
{
unsigned len = fo->st_size();
unsigned d = 7u & (0 - len);
upx_uint64_t zero = 0;
fo->write(&zero, d);
return d + len;
}
static unsigned
funpad4(InputFile *fi)
{
@ -3714,7 +3724,7 @@ void PackLinuxElf64::pack4(OutputFile *fo, Filter &ft)
}
}
if (k && fo) {
set_te64(&ehdri.e_shoff, fpad4(fo));
set_te64(&ehdri.e_shoff, fpad8(fo));
set_te16(&ehdri.e_shentsize, sizeof(*shdri));
set_te16(&ehdri.e_shnum, 1+ k);
Elf64_Shdr shdr_undef; memset(&shdr_undef, 0, sizeof(shdr_undef));