From 2a136c1c1d13c36130178bd49da9db99bacd8bf7 Mon Sep 17 00:00:00 2001 From: John Reiser Date: Wed, 9 Nov 2022 15:39:16 -0800 Subject: [PATCH] End users wish to avoid "double packing". https://github.com/upx/upx/issues/622 modified: src/p_lx_elf.cpp --- src/p_lx_elf.cpp | 3 +++ 1 file changed, 3 insertions(+) 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