From a13b4d10d921e36f6a0b517347d358ee7653b090 Mon Sep 17 00:00:00 2001 From: John Reiser Date: Mon, 26 Sep 2022 15:02:30 -0700 Subject: [PATCH] After upx-3.96, the de-compressing stub for ELF moved ... so unpack() of newly-compressed ELF by upx-3.96 now says "CantUnpackException: need a newer version of UPX" https://github.com/upx/upx/issues/595 modified: p_lx_elf.h modified: packer.h --- src/p_lx_elf.h | 1 + src/packer.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/p_lx_elf.h b/src/p_lx_elf.h index f963d05c..a749e90a 100644 --- a/src/p_lx_elf.h +++ b/src/p_lx_elf.h @@ -40,6 +40,7 @@ public: PackLinuxElf(InputFile *f); virtual ~PackLinuxElf(); /*virtual void buildLoader(const Filter *);*/ + virtual int getVersion() const override { return 14; } // upx-3.96 cannot upack, for instance virtual bool canUnpackVersion(int version) const { return (version >= 11); } virtual int canUnpack() { return super::canUnpack(); } diff --git a/src/packer.h b/src/packer.h index fa1a1af0..3ed72373 100644 --- a/src/packer.h +++ b/src/packer.h @@ -116,6 +116,8 @@ public: virtual ~Packer(); virtual void assertPacker() const; + // getVersion() enables detecting forward incompatibility of unpack() + // by old upx when newer upx changes the format of compressed output. virtual int getVersion() const = 0; // A unique integer ID for this executable format. See conf.h. virtual int getFormat() const = 0;