mirror of
https://github.com/upx/upx
synced 2025-09-28 19:06:07 +08:00
checkPatch() resets
p_lx_elf.cpp p_lx_exc.cpp p_unix.cpp committer: jreiser <jreiser> 1034906580 +0000
This commit is contained in:
parent
66206e8dd7
commit
69cec874a1
|
@ -84,6 +84,7 @@ PackLinuxI386elf::buildLoader(const Filter *ft)
|
||||||
{
|
{
|
||||||
unsigned char tmp[sizeof(linux_i386elf_fold)];
|
unsigned char tmp[sizeof(linux_i386elf_fold)];
|
||||||
memcpy(tmp, linux_i386elf_fold, sizeof(linux_i386elf_fold));
|
memcpy(tmp, linux_i386elf_fold, sizeof(linux_i386elf_fold));
|
||||||
|
checkPatch(0,0,0,0); // reset
|
||||||
if (opt->unix.ptinterp) {
|
if (opt->unix.ptinterp) {
|
||||||
unsigned j;
|
unsigned j;
|
||||||
for (j = 0; j < sizeof(linux_i386elf_fold)-1; ++j) {
|
for (j = 0; j < sizeof(linux_i386elf_fold)-1; ++j) {
|
||||||
|
|
|
@ -197,6 +197,8 @@ PackLinuxI386::buildLinuxLoader(
|
||||||
if (r != UPX_E_OK || h.sz_cpr >= h.sz_unc)
|
if (r != UPX_E_OK || h.sz_cpr >= h.sz_unc)
|
||||||
throwInternalError("loader compression failed");
|
throwInternalError("loader compression failed");
|
||||||
memcpy(cprLoader, &h, sizeof(h));
|
memcpy(cprLoader, &h, sizeof(h));
|
||||||
|
|
||||||
|
// This adds the definition to the "library", to be used later.
|
||||||
linker->addSection("FOLDEXEC", cprLoader, sizeof(h) + h.sz_cpr);
|
linker->addSection("FOLDEXEC", cprLoader, sizeof(h) + h.sz_cpr);
|
||||||
delete cprLoader;
|
delete cprLoader;
|
||||||
|
|
||||||
|
@ -287,6 +289,7 @@ PackLinuxI386::buildLinuxLoader(
|
||||||
int sz_cto = getLoaderSize();
|
int sz_cto = getLoaderSize();
|
||||||
if (0x20==(ft->id & 0xF0) || 0x30==(ft->id & 0xF0)) { // push byte '?' ; cto8
|
if (0x20==(ft->id & 0xF0) || 0x30==(ft->id & 0xF0)) { // push byte '?' ; cto8
|
||||||
patch_le16(ptr_cto, sz_cto, "\x6a?", 0x6a + (ft->cto << 8));
|
patch_le16(ptr_cto, sz_cto, "\x6a?", 0x6a + (ft->cto << 8));
|
||||||
|
checkPatch(0,0,0,0); // reset
|
||||||
}
|
}
|
||||||
// PackHeader and overlay_offset at the end of the output file,
|
// PackHeader and overlay_offset at the end of the output file,
|
||||||
// after the compressed data.
|
// after the compressed data.
|
||||||
|
|
|
@ -89,9 +89,9 @@ void PackUnix::writePackHeader(OutputFile *fo)
|
||||||
set_le32(buf+0, UPX_MAGIC_LE32);
|
set_le32(buf+0, UPX_MAGIC_LE32);
|
||||||
set_le32(buf+4, UPX_MAGIC2_LE32);
|
set_le32(buf+4, UPX_MAGIC2_LE32);
|
||||||
|
|
||||||
checkPatch(NULL, 0, 0, 0);
|
checkPatch(NULL, 0, 0, 0); // reset
|
||||||
patchPackHeader(buf, hsize);
|
patchPackHeader(buf, hsize);
|
||||||
checkPatch(NULL, 0, 0, 0);
|
checkPatch(NULL, 0, 0, 0); // reset
|
||||||
|
|
||||||
fo->write(buf, hsize);
|
fo->write(buf, hsize);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user