diff --git a/src/p_lx_elf.cpp b/src/p_lx_elf.cpp index 9c6025dd..296ef899 100644 --- a/src/p_lx_elf.cpp +++ b/src/p_lx_elf.cpp @@ -2497,6 +2497,9 @@ PackLinuxElf64::canPack() max_offset = UPX_MAX(max_offset, get_te64(&phdr->p_filesz) + get_te64(&phdr->p_offset)); } } + if (canUnpack()) { + throwAlreadyPacked(); + } // We want to compress position-independent executable (gcc -pie) // main programs, but compressing a shared library must be avoided // because the result is no longer usable. In theory, there is no way