mirror of https://github.com/upx/upx.git
src: try to fix canUnpack() confusion - see packer.h
This commit is contained in:
parent
d7508d8c09
commit
16de3e78a5
|
@ -1978,7 +1978,7 @@ bool PackLinuxElf32::calls_crt1(Elf32_Rel const *rel, int sz)
|
|||
#include "p_elf_enum.h"
|
||||
#undef WANT_REL_ENUM
|
||||
|
||||
int PackLinuxElf32::canUnpack() // really 'bool'
|
||||
int PackLinuxElf32::canUnpack() // bool, except -1: format known, but not packed
|
||||
{
|
||||
if (checkEhdr(&ehdri)) {
|
||||
return false;
|
||||
|
@ -2409,7 +2409,7 @@ proceed: ;
|
|||
return true;
|
||||
}
|
||||
|
||||
int PackLinuxElf64::canUnpack() // really 'bool'
|
||||
int PackLinuxElf64::canUnpack() // bool, except -1: format known, but not packed
|
||||
{
|
||||
if (checkEhdr(&ehdri)) {
|
||||
return false;
|
||||
|
@ -2497,7 +2497,7 @@ PackLinuxElf64::canPack()
|
|||
max_offset = UPX_MAX(max_offset, get_te64(&phdr->p_filesz) + get_te64(&phdr->p_offset));
|
||||
}
|
||||
}
|
||||
if (canUnpack()) {
|
||||
if (canUnpack() > 0) {
|
||||
throwAlreadyPacked();
|
||||
}
|
||||
// We want to compress position-independent executable (gcc -pie)
|
||||
|
@ -5340,7 +5340,7 @@ PackLinuxElf32x86::~PackLinuxElf32x86()
|
|||
{
|
||||
}
|
||||
|
||||
int PackLinuxElf32x86::canUnpack() // really 'bool'
|
||||
int PackLinuxElf32x86::canUnpack() // bool, except -1: format known, but not packed
|
||||
{
|
||||
if (super::canUnpack()) {
|
||||
return true;
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
/*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 override { return (version >= 11); }
|
||||
virtual int canUnpack() override { return super::canUnpack(); } // really 'bool'
|
||||
virtual int canUnpack() override { return super::canUnpack(); } // bool, except -1: format known, but not packed
|
||||
|
||||
protected:
|
||||
virtual const int *getCompressionMethods(int method, int level) const override;
|
||||
|
@ -123,7 +123,7 @@ protected:
|
|||
virtual void PackLinuxElf32help1(InputFile *f);
|
||||
virtual int checkEhdr(Elf32_Ehdr const *ehdr) const;
|
||||
virtual bool canPack() override;
|
||||
virtual int canUnpack() override; // really 'bool'
|
||||
virtual int canUnpack() override; // bool, except -1: format known, but not packed
|
||||
|
||||
// These ARM routines are essentially common to big/little endian,
|
||||
// but the class hierarchy splits after this class.
|
||||
|
@ -266,7 +266,7 @@ protected:
|
|||
virtual void PackLinuxElf64help1(InputFile *f);
|
||||
virtual int checkEhdr(Elf64_Ehdr const *ehdr) const;
|
||||
virtual bool canPack() override;
|
||||
virtual int canUnpack() override; // really 'bool'
|
||||
virtual int canUnpack() override; // bool, except -1: format known, but not packed
|
||||
|
||||
virtual void pack1(OutputFile *, Filter &) override; // generate executable header
|
||||
virtual void asl_pack2_Shdrs(OutputFile *); // AndroidSharedLibrary processes Shdrs
|
||||
|
@ -559,7 +559,7 @@ public:
|
|||
virtual const char *getName() const override { return "linux/i386"; }
|
||||
virtual const char *getFullName(const options_t *) const override { return "i386-linux.elf"; }
|
||||
virtual const int *getFilters() const override;
|
||||
virtual int canUnpack() override; // reallly 'bool'
|
||||
virtual int canUnpack() override; // bool, except -1: format known, but not packed
|
||||
|
||||
protected:
|
||||
virtual void pack1(OutputFile *, Filter &) override; // generate executable header
|
||||
|
|
|
@ -49,7 +49,7 @@ public:
|
|||
virtual void unpack(OutputFile *fo) override;
|
||||
|
||||
virtual bool canPack() override;
|
||||
virtual int canUnpack() override; // really 'bool'
|
||||
virtual int canUnpack() override; // bool, except -1: format known, but not packed
|
||||
int find_overlay_offset(MemBuffer const &buf);
|
||||
|
||||
protected:
|
||||
|
|
|
@ -155,12 +155,10 @@ protected:
|
|||
public:
|
||||
// canPack() should throw a cantPackException eplaining why it
|
||||
// cannot pack a recognized format.
|
||||
// canUnpack() can return -1 meaning "format recognized, but file
|
||||
// is definitely not packed" (see packmast.cpp).
|
||||
virtual bool canPack() = 0;
|
||||
// canUnpack() can return -1 meaning "format recognized, but file
|
||||
// is definitely not packed". See packmast.cpp try_unpack().
|
||||
virtual int canUnpack() = 0;
|
||||
virtual int canTest() { return canUnpack(); }
|
||||
virtual int canList() { return canUnpack(); }
|
||||
|
||||
protected:
|
||||
// main compression drivers
|
||||
|
|
Loading…
Reference in New Issue