From 69cec874a1b6f6fcac53100dd09141f931b08898 Mon Sep 17 00:00:00 2001 From: John Reiser Date: Fri, 18 Oct 2002 02:03:00 +0000 Subject: [PATCH] checkPatch() resets p_lx_elf.cpp p_lx_exc.cpp p_unix.cpp committer: jreiser 1034906580 +0000 --- src/p_lx_elf.cpp | 1 + src/p_lx_exc.cpp | 3 +++ src/p_unix.cpp | 4 ++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/p_lx_elf.cpp b/src/p_lx_elf.cpp index ce8d44df..f49b7fd8 100644 --- a/src/p_lx_elf.cpp +++ b/src/p_lx_elf.cpp @@ -84,6 +84,7 @@ PackLinuxI386elf::buildLoader(const Filter *ft) { unsigned char tmp[sizeof(linux_i386elf_fold)]; memcpy(tmp, linux_i386elf_fold, sizeof(linux_i386elf_fold)); + checkPatch(0,0,0,0); // reset if (opt->unix.ptinterp) { unsigned j; for (j = 0; j < sizeof(linux_i386elf_fold)-1; ++j) { diff --git a/src/p_lx_exc.cpp b/src/p_lx_exc.cpp index 63478df8..a2dff550 100644 --- a/src/p_lx_exc.cpp +++ b/src/p_lx_exc.cpp @@ -197,6 +197,8 @@ PackLinuxI386::buildLinuxLoader( if (r != UPX_E_OK || h.sz_cpr >= h.sz_unc) throwInternalError("loader compression failed"); 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); delete cprLoader; @@ -287,6 +289,7 @@ PackLinuxI386::buildLinuxLoader( int sz_cto = getLoaderSize(); if (0x20==(ft->id & 0xF0) || 0x30==(ft->id & 0xF0)) { // push byte '?' ; cto8 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, // after the compressed data. diff --git a/src/p_unix.cpp b/src/p_unix.cpp index 68a72182..274da86f 100644 --- a/src/p_unix.cpp +++ b/src/p_unix.cpp @@ -89,9 +89,9 @@ void PackUnix::writePackHeader(OutputFile *fo) set_le32(buf+0, UPX_MAGIC_LE32); set_le32(buf+4, UPX_MAGIC2_LE32); - checkPatch(NULL, 0, 0, 0); + checkPatch(NULL, 0, 0, 0); // reset patchPackHeader(buf, hsize); - checkPatch(NULL, 0, 0, 0); + checkPatch(NULL, 0, 0, 0); // reset fo->write(buf, hsize); }