Compare commits

...

41 Commits

Author SHA1 Message Date
Markus F.X.J. Oberhumer d767332943 CI updates
CI / Rebuild stubs (push) Has been cancelled
CI / ${{ format('{0}', matrix.os) }}-0 (ubuntu-22.04) (push) Has been cancelled
CI / ${{ format('{0}', matrix.os) }}-0 (ubuntu-22.04-arm) (push) Has been cancelled
CI / ${{ format('{0}', matrix.os) }}-0 (ubuntu-24.04) (push) Has been cancelled
CI / ${{ format('{0}', matrix.os) }}-0 (ubuntu-24.04-arm) (push) Has been cancelled
CI / ${{ format('{0}', matrix.os) }} (ubuntu-22.04, true) (push) Has been cancelled
CI / ${{ format('{0}', matrix.os) }} (ubuntu-24.04, true, true) (push) Has been cancelled
CI / ${{ format('{0} {1}{2}', matrix.os, matrix.xcode_version && 'xcode-' || '', matrix.xcode_version) }} (gcc-13, g++-13, macos-14, true) (push) Has been cancelled
CI / ${{ format('{0} {1}{2}', matrix.os, matrix.xcode_version && 'xcode-' || '', matrix.xcode_version) }} (gcc-14, g++-14, macos-15, true) (push) Has been cancelled
CI / ${{ format('{0} {1}{2}', matrix.os, matrix.xcode_version && 'xcode-' || '', matrix.xcode_version) }} (gcc-15, g++-15, macos-26, true) (push) Has been cancelled
CI / ${{ format('{0}', matrix.name) }} (windows-11-arm64, windows-11-arm, arm64, 2022) (push) Has been cancelled
CI / ${{ format('{0}', matrix.name) }} (windows-11-arm64ec, windows-11-arm, true, arm64, 2022) (push) Has been cancelled
CI / ${{ format('{0}', matrix.name) }} (windows-2022-amd64, windows-2022, amd64, 2022) (push) Has been cancelled
CI / ${{ format('{0}', matrix.name) }} (windows-2022-i386, windows-2022, amd64_x86, 2022) (push) Has been cancelled
CI / ${{ format('{0}', matrix.name) }} (windows-2025-amd64, windows-2025, amd64, 2022) (push) Has been cancelled
CI / ${{ format('{0}', matrix.name) }} (windows-2025-i386, windows-2025, amd64_x86, 2022) (push) Has been cancelled
CI / ${{ format('windows-bh {0}', matrix.name) }} (-arm64EC, /machine:arm64ec, arm64ec-win64-vs2025, windows-2025, amd64_arm64, 2022) (push) Has been cancelled
CI / ${{ format('windows-bh {0}', matrix.name) }} (amd64-win64-vs2025, windows-2025, amd64, 2022) (push) Has been cancelled
CI / ${{ format('windows-bh {0}', matrix.name) }} (arm64-win64-vs2025, windows-2025, amd64_arm64, 2022) (push) Has been cancelled
CI / ${{ format('zigcc {0} {1}', matrix.zig_target, matrix.zig_pic) }} (-march=i586, i386-linux-gnu.2.17) (push) Has been cancelled
CI / ${{ format('zigcc {0} {1}', matrix.zig_target, matrix.zig_pic) }} (-march=i586, i386-linux-gnu.2.3.4) (push) Has been cancelled
CI / ${{ format('zigcc {0} {1}', matrix.zig_target, matrix.zig_pic) }} (aarch64-macos-none) (push) Has been cancelled
CI / ${{ format('zigcc {0} {1}', matrix.zig_target, matrix.zig_pic) }} (aarch64-windows-gnu) (push) Has been cancelled
CI / ${{ format('zigcc {0} {1}', matrix.zig_target, matrix.zig_pic) }} (alpine:3.18, qemu-x86_64, -fPIE, x86_64-linux-musl) (push) Has been cancelled
CI / ${{ format('zigcc {0} {1}', matrix.zig_target, matrix.zig_pic) }} (i386-windows-gnu) (push) Has been cancelled
CI / ${{ format('zigcc {0} {1}', matrix.zig_target, matrix.zig_pic) }} (qemu-aarch64, aarch64-linux-musl) (push) Has been cancelled
CI / ${{ format('zigcc {0} {1}', matrix.zig_target, matrix.zig_pic) }} (qemu-arm, arm-linux-musleabihf) (push) Has been cancelled
CI / ${{ format('zigcc {0} {1}', matrix.zig_target, matrix.zig_pic) }} (qemu-armeb, armeb-linux-musleabihf) (push) Has been cancelled
CI / ${{ format('zigcc {0} {1}', matrix.zig_target, matrix.zig_pic) }} (qemu-i386, -march=i586, -fPIE, i386-linux-musl) (push) Has been cancelled
CI / ${{ format('zigcc {0} {1}', matrix.zig_target, matrix.zig_pic) }} (qemu-i386, -march=i586, i386-linux-musl) (push) Has been cancelled
CI / ${{ format('zigcc {0} {1}', matrix.zig_target, matrix.zig_pic) }} (qemu-mips, mips-linux-musleabi) (push) Has been cancelled
CI / ${{ format('zigcc {0} {1}', matrix.zig_target, matrix.zig_pic) }} (qemu-mips, mips-linux-musleabihf) (push) Has been cancelled
CI / ${{ format('zigcc {0} {1}', matrix.zig_target, matrix.zig_pic) }} (qemu-mipsel, mipsel-linux-musleabi) (push) Has been cancelled
CI / ${{ format('zigcc {0} {1}', matrix.zig_target, matrix.zig_pic) }} (qemu-mipsel, mipsel-linux-musleabihf) (push) Has been cancelled
CI / ${{ format('zigcc {0} {1}', matrix.zig_target, matrix.zig_pic) }} (qemu-ppc, powerpc-linux-musleabihf) (push) Has been cancelled
CI / ${{ format('zigcc {0} {1}', matrix.zig_target, matrix.zig_pic) }} (qemu-ppc64, -fPIE, powerpc64-linux-musl) (push) Has been cancelled
CI / ${{ format('zigcc {0} {1}', matrix.zig_target, matrix.zig_pic) }} (qemu-ppc64, powerpc64-linux-musl) (push) Has been cancelled
CI / ${{ format('zigcc {0} {1}', matrix.zig_target, matrix.zig_pic) }} (qemu-ppc64le, -fPIE, powerpc64le-linux-musl) (push) Has been cancelled
CI / ${{ format('zigcc {0} {1}', matrix.zig_target, matrix.zig_pic) }} (qemu-ppc64le, powerpc64le-linux-musl) (push) Has been cancelled
CI / ${{ format('zigcc {0} {1}', matrix.zig_target, matrix.zig_pic) }} (qemu-riscv64, UPX-UNSUPPORTED, -fPIE, riscv64-linux-musl) (push) Has been cancelled
CI / ${{ format('zigcc {0} {1}', matrix.zig_target, matrix.zig_pic) }} (qemu-riscv64, UPX-UNSUPPORTED, riscv64-linux-musl) (push) Has been cancelled
CI / ${{ format('zigcc {0} {1}', matrix.zig_target, matrix.zig_pic) }} (qemu-x86_64, x86_64-linux-gnu.2.3.4) (push) Has been cancelled
CI / ${{ format('zigcc {0} {1}', matrix.zig_target, matrix.zig_pic) }} (qemu-x86_64, x86_64-linux-musl) (push) Has been cancelled
CI / ${{ format('zigcc {0} {1}', matrix.zig_target, matrix.zig_pic) }} (x86_64-macos-none) (push) Has been cancelled
CI / ${{ format('zigcc {0} {1}', matrix.zig_target, matrix.zig_pic) }} (x86_64-windows-gnu) (push) Has been cancelled
CI / ${{ format('{0} {1}{2}', matrix.os, matrix.xcode_version && 'xcode-' || '', matrix.xcode_version) }} (gcc-14, g++-14, macos-15-intel, true) (push) Has been cancelled
CI / ${{ format('windows-bh {0}', matrix.name) }} (i386-win32-vs2025, windows-2025, amd64_x86, 2022) (push) Has been cancelled
CI / ${{ format('zigcc {0} {1}', matrix.zig_target, matrix.zig_pic) }} (alpine:3.18, qemu-aarch64, -fPIE, aarch64-linux-musl) (push) Has been cancelled
CI / ${{ format('zigcc {0} {1}', matrix.zig_target, matrix.zig_pic) }} (qemu-x86_64, x86_64-linux-gnu.2.17) (push) Has been cancelled
2025-12-12 11:44:17 +01:00
John Reiser f3d4503e93 clang-format inconsistency
modified:   p_elf_enum.h
2025-12-10 10:33:46 -08:00
John Reiser 70cb4aadda Fix "bad slide" on 32-bit ARM shared library
https://github.com/upx/upx/issues/944
	modified:   src/p_elf_enum.h
	modified:   src/p_lx_elf.cpp
2025-12-10 10:24:53 -08:00
John Reiser 75325bf9ef bb1
modified:   src/p_lx_elf.cpp
2025-12-10 10:24:53 -08:00
Markus F.X.J. Oberhumer 669bf2251f CI updates 2025-12-10 12:30:09 +01:00
Markus F.X.J. Oberhumer 190fd76583 CI updates 2025-12-10 10:15:51 +01:00
Markus F.X.J. Oberhumer 8622e22be0 CI updates 2025-12-02 13:54:23 +01:00
Markus F.X.J. Oberhumer 139a0324b6 CI updates 2025-11-29 18:10:15 +01:00
Markus F.X.J. Oberhumer e39f2b2b2f CI updates 2025-11-29 15:12:15 +01:00
John Reiser 7a46365296 Fix unpack of PackLinuxI386 for upx version 11
Old b_info without .b_method
https://github.com/upx/upx/issues/942
        modified:   p_unix.cpp
2025-11-25 04:29:52 -08:00
Markus F.X.J. Oberhumer f83b7690e5 CI updates 2025-11-25 09:15:40 +01:00
Markus F.X.J. Oberhumer 98c00d0fcb CI updates 2025-11-08 09:05:25 +01:00
Markus F.X.J. Oberhumer b04d566b83 CI updates 2025-11-03 15:41:08 +01:00
Markus F.X.J. Oberhumer b3c765ac7c CI updates 2025-11-02 23:52:34 +01:00
Markus F.X.J. Oberhumer f7146b5af9 CI updates 2025-11-02 18:41:09 +01:00
John Reiser 5dbf94e49b Update README.SRC to enable success by newbies.
Need i386 version of zlib, updated libmfpr.so, g++ (not clang++).
https://github.com/upx/upx/issues/938
	modified:   README.SRC
2025-10-29 11:14:58 -07:00
Markus F.X.J. Oberhumer 2e39c924d5 CI updates 2025-10-29 10:03:11 +01:00
John Reiser 3068d19492 WinPE with TLS: fix relocation bugs
--strip-relocs not needed after bugfixes, but keep safety check.
Thanks to @ml1050.
https://github.com/upx/upx/issues/880
	modified:   pefile.cpp
2025-10-26 13:36:43 -07:00
Markus F.X.J. Oberhumer 09d7d08e55 all: version bump 2025-10-24 22:02:13 +02:00
Markus F.X.J. Oberhumer 31ff38049f CI updates 2025-10-24 21:53:23 +02:00
John Reiser a5f5e7fc73 WinPE: Require --strip-relocs if relocating compressed data
Thanks to @bitraid for investigating and suggestions.
https://github.com/upx/upx/issues/880
	modified:   pefile.cpp
2025-10-24 08:35:20 -07:00
Markus F.X.J. Oberhumer 3533ebe804 CI updates 2025-10-13 01:44:37 +02:00
Markus F.X.J. Oberhumer c4ed5cc159 CI updates 2025-10-11 02:59:23 +02:00
John Reiser 303ac34539 ord() not needed
modified:   scripts/bin2h.py
2025-10-10 13:34:15 -07:00
John Reiser e8947a6812 Cleanup deubg
modified:   scripts/brandelf.py
2025-10-10 13:10:14 -07:00
John Reiser 533e642945 Merge branch 'jreiser-python3a' into jreiser-python3 2025-10-10 11:50:22 -07:00
John Reiser 8ab47ba8a4 More python3
modified:   scripts/brandelf.py
	modified:   scripts/gpp_inc.py
	modified:   src/arch/i086/cleanasm.py
2025-10-10 11:43:39 -07:00
John Reiser e4c638aa73 Mixing python3 strings with bytes requires .encode and .decode
modified:   stub/scripts/bin2h.py
	modified:   stub/scripts/brandelf.py
	modified:   stub/scripts/gpp_inc.py
	modified:   stub/scripts/xstrip.py
2025-10-10 08:56:37 -07:00
John Reiser 4ec866594b Mixing python3 strings with bytes requires .encode and .decode
modified:   stub/scripts/bin2h.py
	modified:   stub/scripts/brandelf.py
	modified:   stub/scripts/gpp_inc.py
	modified:   stub/scripts/xstrip.py
2025-10-10 08:38:59 -07:00
John Reiser a3d5a0a7b8 Replace 'has_key' with 'in'
modified:   src/stub/scripts/bin2h.py
	modified:   src/stub/scripts/xstrip.py
	modified:   src/stub/src/arch/i086/cleanasm.py
2025-10-08 14:35:13 -07:00
John Reiser 59d5d25a77 python-is-python3
modified:   ci.yml
2025-10-08 14:24:32 -07:00
John Reiser e60ebd4027 install python
modified:   ci.yml
2025-10-08 14:22:12 -07:00
John Reiser 3a61782f12 no more PYTHON2
modified:   src/stub/Makefile
2025-10-08 14:18:52 -07:00
John Reiser 11041f44e6 need ../deps/packages
modified:   ci.yml
2025-10-08 14:05:01 -07:00
John Reiser 649063c8c6 ci.yml syntax
modified:   ci.yml
2025-10-08 08:40:23 -07:00
John Reiser 36271c3244 python (python3) replaces python2
https://github.com/upx/upx/issues/868
Thanks to 'tansy' for the patches to *.py .

	modified:   .github/workflows/ci.yml
	modified:   src/stub/scripts/bin2h.py
	modified:   src/stub/scripts/brandelf.py
	modified:   src/stub/scripts/gpp_inc.py
	modified:   src/stub/scripts/xstrip.py
	modified:   src/stub/src/arch/i086/cleanasm.py
	modified:   src/stub/src/arch/i086/wdis2gas.py
2025-10-08 08:32:24 -07:00
Markus F.X.J. Oberhumer 3c3caaa567 CI updates 2025-10-07 22:00:31 +02:00
Markus F.X.J. Oberhumer d3504d8af2 CI updates 2025-10-05 13:17:03 +02:00
Markus F.X.J. Oberhumer 12d1c6bbda CI updates 2025-09-30 20:38:33 +02:00
Markus F.X.J. Oberhumer 466ceb4a1f CI updates 2025-09-18 12:03:48 +02:00
John Reiser 3b71139426 WIP Propagate CETCOMPAT flag for PeFile.
https://github.com/upx/upx/issues/909
	modified:   pefile.cpp
	modified:   pefile.h
2025-09-13 15:50:01 -07:00
52 changed files with 1474 additions and 888 deletions
+1
View File
@@ -20,6 +20,7 @@ Checks: >
-bugprone-suspicious-memory-comparison, -bugprone-suspicious-memory-comparison,
-bugprone-suspicious-string-compare, -bugprone-suspicious-string-compare,
-bugprone-switch-missing-default-case, -bugprone-switch-missing-default-case,
-bugprone-unintended-char-ostream-output,
clang-analyzer-*, clang-analyzer-*,
-clang-analyzer-optin.performance.Padding, -clang-analyzer-optin.performance.Padding,
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling, -clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
+79 -58
View File
@@ -22,8 +22,8 @@ env:
UPX_DEBUG_TEST_FLOAT_DIVISION_BY_ZERO: 1 UPX_DEBUG_TEST_FLOAT_DIVISION_BY_ZERO: 1
UPX_DEBUG_TEST_LIBC_QSORT: 1 UPX_DEBUG_TEST_LIBC_QSORT: 1
ZSTD_CLEVEL: 17 ZSTD_CLEVEL: 17
# 2025-08-19 # 2025-10-11
ZIG_DIST_VERSION: 0.15.1 ZIG_DIST_VERSION: 0.15.2
jobs: jobs:
job-rebuild-and-verify-stubs: job-rebuild-and-verify-stubs:
@@ -39,13 +39,14 @@ jobs:
dpkg --add-architecture i386 dpkg --add-architecture i386
apt-get update && apt-get upgrade -y apt-get update && apt-get upgrade -y
# install system packages # install system packages
apt-get install -y --no-install-recommends bash ca-certificates curl git libmpc3 make perl-base tar time xz-utils libc6:i386 zlib1g:i386 apt-get install -y --no-install-recommends bash ca-certificates curl git libmpc3 make perl-base python3-minimal tar time xz-utils libc6:i386 zlib1g:i386
# install python2-minimal packages from Debian-11 apt-get install -y gcc-riscv64-linux-gnu
mkdir ../deps; cd ../deps; mkdir packages mkdir ../deps; cd ../deps; mkdir packages
curl -sS -L -O https://ftp.debian.org/debian/pool/main/p/python2.7/libpython2.7-minimal_2.7.18-8+deb11u1_amd64.deb ### install python2-minimal packages from Debian-11
curl -sS -L -O https://ftp.debian.org/debian/pool/main/p/python2.7/python2.7-minimal_2.7.18-8+deb11u1_amd64.deb ## curl -sS -L -O https://ftp.debian.org/debian/pool/main/p/python2.7/libpython2.7-minimal_2.7.18-8+deb11u1_amd64.deb
dpkg -i ./*python2*.deb && rm ./*python2*.deb && ldconfig ## curl -sS -L -O https://ftp.debian.org/debian/pool/main/p/python2.7/python2.7-minimal_2.7.18-8+deb11u1_amd64.deb
ln -s -v python2.7 /usr/bin/python2 ## dpkg -i ./*python2*.deb && rm ./*python2*.deb && ldconfig
## ln -s -v python2.7 /usr/bin/python2
# manually unpack and install compat libs from Ubuntu-16.04 # manually unpack and install compat libs from Ubuntu-16.04
curl -sS -L -O https://archive.kernel.org/ubuntu-archive/ubuntu/pool/main/m/mpfr4/libmpfr4_3.1.6-1_amd64.deb curl -sS -L -O https://archive.kernel.org/ubuntu-archive/ubuntu/pool/main/m/mpfr4/libmpfr4_3.1.6-1_amd64.deb
for f in ./*.deb; do dpkg -x $f ./packages; done for f in ./*.deb; do dpkg -x $f ./packages; done
@@ -53,6 +54,7 @@ jobs:
rm -rf ./*.deb ./packages && ldconfig rm -rf ./*.deb ./packages && ldconfig
# install upx-stubtools # install upx-stubtools
curl -sS -L https://github.com/upx/upx-stubtools/releases/download/v20221212/bin-upx-20221212.tar.xz | tar -xJ curl -sS -L https://github.com/upx/upx-stubtools/releases/download/v20221212/bin-upx-20221212.tar.xz | tar -xJ
- run: dpkg -l
- name: Check out code - name: Check out code
run: | run: |
git config --global --add safe.directory '*' # needed when running in a container git config --global --add safe.directory '*' # needed when running in a container
@@ -102,7 +104,7 @@ jobs:
- run: (sudo dmidecode | sed -n -e '/System Information/,/^$/p') || true - run: (sudo dmidecode | sed -n -e '/System Information/,/^$/p') || true
- run: sudo dmidecode -q || true - run: sudo dmidecode -q || true
- run: sudo dmidecode || true - run: sudo dmidecode || true
- uses: actions/checkout@v5 - uses: actions/checkout@v6
with: { submodules: true } with: { submodules: true }
- run: make build/extra/gcc/all - run: make build/extra/gcc/all
- run: make build/extra/clang/all - run: make build/extra/clang/all
@@ -117,7 +119,7 @@ jobs:
(cd tmp/artifact && tar --sort=name --zstd -cf "$N.tar.zst" "$N" && rm -rf "./$N" && ls -la && zstd -tq "$N.tar.zst") (cd tmp/artifact && tar --sort=name --zstd -cf "$N.tar.zst" "$N" && rm -rf "./$N" && ls -la && zstd -tq "$N.tar.zst")
echo "artifact_name=$N" >> $GITHUB_ENV echo "artifact_name=$N" >> $GITHUB_ENV
- name: ${{ format('Upload artifact {0}', env.artifact_name) }} - name: ${{ format('Upload artifact {0}', env.artifact_name) }}
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v5
with: { name: '${{ env.artifact_name }}', path: tmp/artifact } with: { name: '${{ env.artifact_name }}', path: tmp/artifact }
- name: Run install tests - name: Run install tests
run: | run: |
@@ -129,11 +131,15 @@ jobs:
jobs="gcc/debug gcc/release clang/debug clang/release" jobs="gcc/debug gcc/release clang/debug clang/release"
echo "===== parallel jobs: $jobs" echo "===== parallel jobs: $jobs"
parallel -kv --lb 'cd build/extra/{} && bash ../../../../misc/testsuite/mimic_ctest_sigsegv.sh' ::: $jobs parallel -kv --lb 'cd build/extra/{} && bash ../../../../misc/testsuite/mimic_ctest_sigsegv.sh' ::: $jobs
ls -ld ./build/*/*/*/upx-* || true
rm -rf ./build/*/*/*/upx-*
- name: Run ctest tests - name: Run ctest tests
run: | run: |
jobs="gcc/debug gcc/release clang/debug clang/release" jobs="gcc/debug gcc/release clang/debug clang/release"
echo "===== parallel jobs: $jobs" echo "===== parallel jobs: $jobs"
CTEST_JOBS=2 parallel -kv --lb 'make build/extra/{}+test' ::: $jobs CTEST_JOBS=2 parallel -kv --lb 'make build/extra/{}+test' ::: $jobs
ls -ld ./build/*/*/*/XTesting/*/* || true
rm -rf ./build/*/*/*/XTesting/*/*
- name: Mimic ctest tests with Valgrind - name: Mimic ctest tests with Valgrind
run: | run: |
export UPX_CONFIG_DISABLE_EXHAUSTIVE_TESTS=ON # valgrind is SLOW export UPX_CONFIG_DISABLE_EXHAUSTIVE_TESTS=ON # valgrind is SLOW
@@ -142,6 +148,8 @@ jobs:
jobs="gcc/debug gcc/release clang/release" jobs="gcc/debug gcc/release clang/release"
echo "===== parallel jobs: $jobs" echo "===== parallel jobs: $jobs"
parallel -kv --lb 'cd build/extra/{} && bash ../../../../misc/testsuite/mimic_ctest.sh' ::: $jobs parallel -kv --lb 'cd build/extra/{} && bash ../../../../misc/testsuite/mimic_ctest.sh' ::: $jobs
ls -ld ./build/*/*/*/upx-* || true
rm -rf ./build/*/*/*/upx-*
job-linux-cmake: # uses cmake + make job-linux-cmake: # uses cmake + make
if: true if: true
@@ -181,7 +189,7 @@ jobs:
sudo apt-get install -y wine wine32:i386 wine64 sudo apt-get install -y wine wine32:i386 wine64
ls -l /usr/bin/wine* ls -l /usr/bin/wine*
mkdir -p -v ~/.wine && wineboot --init mkdir -p -v ~/.wine && wineboot --init
- uses: actions/checkout@v5 - uses: actions/checkout@v6
with: { submodules: true } with: { submodules: true }
- name: Check out test suite - name: Check out test suite
run: git clone --depth=1 https://github.com/upx/upx-testsuite ../deps/upx-testsuite run: git clone --depth=1 https://github.com/upx/upx-testsuite ../deps/upx-testsuite
@@ -222,7 +230,7 @@ jobs:
(cd tmp/artifact && tar --sort=name --zstd -cf "$N.tar.zst" "$N" && rm -rf "./$N" && ls -la && zstd -tq "$N.tar.zst") (cd tmp/artifact && tar --sort=name --zstd -cf "$N.tar.zst" "$N" && rm -rf "./$N" && ls -la && zstd -tq "$N.tar.zst")
echo "artifact_name=$N" >> $GITHUB_ENV echo "artifact_name=$N" >> $GITHUB_ENV
- name: ${{ format('Upload artifact {0}', env.artifact_name) }} - name: ${{ format('Upload artifact {0}', env.artifact_name) }}
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v5
with: { name: '${{ env.artifact_name }}', path: tmp/artifact } with: { name: '${{ env.artifact_name }}', path: tmp/artifact }
- name: Run install tests - name: Run install tests
run: | run: |
@@ -238,6 +246,8 @@ jobs:
test "${{ matrix.use_extra }}" = "true" && jobs="$jobs gcc-m32/debug gcc-m32/release" test "${{ matrix.use_extra }}" = "true" && jobs="$jobs gcc-m32/debug gcc-m32/release"
echo "===== parallel jobs: $jobs" echo "===== parallel jobs: $jobs"
parallel -kv --lb 'cd build/extra/{} && bash ../../../../misc/testsuite/mimic_ctest_sigsegv.sh' ::: $jobs parallel -kv --lb 'cd build/extra/{} && bash ../../../../misc/testsuite/mimic_ctest_sigsegv.sh' ::: $jobs
ls -ld ./build/*/*/*/upx-* || true
rm -rf ./build/*/*/*/upx-*
- name: Run ctest tests - name: Run ctest tests
run: | run: |
jobs="gcc/debug gcc/release clang/debug clang/release" jobs="gcc/debug gcc/release clang/debug clang/release"
@@ -246,6 +256,8 @@ jobs:
command -v wine >/dev/null && jobs="$jobs cross-windows-mingw64/debug cross-windows-mingw64/release" command -v wine >/dev/null && jobs="$jobs cross-windows-mingw64/debug cross-windows-mingw64/release"
echo "===== parallel jobs: $jobs" echo "===== parallel jobs: $jobs"
CTEST_JOBS=2 parallel -kv --lb 'make build/extra/{}+test' ::: $jobs CTEST_JOBS=2 parallel -kv --lb 'make build/extra/{}+test' ::: $jobs
ls -ld ./build/*/*/*/XTesting/*/* || true
rm -rf ./build/*/*/*/XTesting/*/*
- name: Mimic ctest tests with Valgrind - name: Mimic ctest tests with Valgrind
if: true # note: valgrind is SLOW if: true # note: valgrind is SLOW
run: | run: |
@@ -257,6 +269,8 @@ jobs:
test "${{ matrix.use_extra }}" = "true" && jobs="$jobs gcc-m32/debug gcc-m32/release" test "${{ matrix.use_extra }}" = "true" && jobs="$jobs gcc-m32/debug gcc-m32/release"
echo "===== parallel jobs: $jobs" echo "===== parallel jobs: $jobs"
parallel -kv --lb 'cd build/extra/{} && bash ../../../../misc/testsuite/mimic_ctest.sh' ::: $jobs parallel -kv --lb 'cd build/extra/{} && bash ../../../../misc/testsuite/mimic_ctest.sh' ::: $jobs
ls -ld ./build/*/*/*/upx-* || true
rm -rf ./build/*/*/*/upx-*
fi fi
- name: Run file system tests - name: Run file system tests
run: | run: |
@@ -282,6 +296,8 @@ jobs:
test "${{ matrix.use_extra }}" = "true" && jobs="$jobs gcc-m32/debug gcc-m32/release" test "${{ matrix.use_extra }}" = "true" && jobs="$jobs gcc-m32/debug gcc-m32/release"
echo "===== parallel jobs: $jobs" echo "===== parallel jobs: $jobs"
parallel -kv --lb 'cd build/extra/{} && bash ../../../../misc/testsuite/upx_testsuite_1.sh' ::: $jobs parallel -kv --lb 'cd build/extra/{} && bash ../../../../misc/testsuite/upx_testsuite_1.sh' ::: $jobs
ls -ld ./build/*/*/*/tmp-upx-testsuite* || true
rm -rf ./build/*/*/*/tmp-upx-testsuite*
job-macos-cmake: # uses cmake + make job-macos-cmake: # uses cmake + make
if: true if: true
@@ -292,10 +308,10 @@ jobs:
include: include:
# NOTE: Xcode updates regularly tend to break Homebrew clang/gcc; often some ld64 issue; use "xcode_version" as needed; or try "-Wl,-ld_classic" # NOTE: Xcode updates regularly tend to break Homebrew clang/gcc; often some ld64 issue; use "xcode_version" as needed; or try "-Wl,-ld_classic"
# NOTE: macos does not have "env -C"; only with brew coreutils # NOTE: macos does not have "env -C"; only with brew coreutils
- { os: macos-13, gcc: gcc-12, gxx: g++-12, testsuite: true }
- { os: macos-14, gcc: gcc-13, gxx: g++-13, testsuite: true } - { os: macos-14, gcc: gcc-13, gxx: g++-13, testsuite: true }
# { os: macos-15, gcc: gcc-14, gxx: g++-14, testsuite: true } - { os: macos-15, gcc: gcc-14, gxx: g++-14, testsuite: true }
- { os: macos-15, testsuite: true } - { os: macos-26, gcc: gcc-15, gxx: g++-15, testsuite: true }
- { os: macos-15-intel, gcc: gcc-14, gxx: g++-14, testsuite: true }
name: ${{ format('{0} {1}{2}', matrix.os, matrix.xcode_version && 'xcode-' || '', matrix.xcode_version) }} name: ${{ format('{0} {1}{2}', matrix.os, matrix.xcode_version && 'xcode-' || '', matrix.xcode_version) }}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
@@ -320,9 +336,9 @@ jobs:
echo "UPX_DEBUG_FORCE_PACK_MACOS=1" >> $GITHUB_ENV echo "UPX_DEBUG_FORCE_PACK_MACOS=1" >> $GITHUB_ENV
case "${{ matrix.os }}" in case "${{ matrix.os }}" in
# TODO FIXME: UPX on macos-13+ is broken => disable run-packed for now # TODO FIXME: UPX on macos-13+ is broken => disable run-packed for now
macos-1[345]) echo "UPX_CONFIG_DISABLE_RUN_PACKED_TEST=ON" >> $GITHUB_ENV ;; macos-[12][3456]*) echo "UPX_CONFIG_DISABLE_RUN_PACKED_TEST=ON" >> $GITHUB_ENV ;;
esac esac
- uses: actions/checkout@v5 - uses: actions/checkout@v6
with: { submodules: true } with: { submodules: true }
- name: Check out test suite - name: Check out test suite
if: ${{ matrix.testsuite }} if: ${{ matrix.testsuite }}
@@ -364,13 +380,14 @@ jobs:
(cd tmp/artifact && gtar --sort=name --zstd -cf "$N.tar.zst" "$N" && rm -rf "./$N" && ls -la && zstd -tq "$N.tar.zst") (cd tmp/artifact && gtar --sort=name --zstd -cf "$N.tar.zst" "$N" && rm -rf "./$N" && ls -la && zstd -tq "$N.tar.zst")
echo "artifact_name=$N" >> $GITHUB_ENV echo "artifact_name=$N" >> $GITHUB_ENV
- name: ${{ format('Upload artifact {0}', env.artifact_name) }} - name: ${{ format('Upload artifact {0}', env.artifact_name) }}
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v5
with: { name: '${{ env.artifact_name }}', path: tmp/artifact } with: { name: '${{ env.artifact_name }}', path: tmp/artifact }
- name: Run install tests - name: Run install tests
run: | run: |
(cd build/extra/clang/release && DESTDIR="$PWD/Install with cmake" cmake --install .) (cd build/extra/clang/release && DESTDIR="$PWD/Install with cmake" cmake --install .)
(cd build/extra/clang/release && DESTDIR="$PWD/Install with make" make install) (cd build/extra/clang/release && DESTDIR="$PWD/Install with make" make install)
- name: Run ctest tests - name: Run ctest tests
if: ${{ matrix.testsuite }}
run: | run: |
for f in ./build/extra/*/*/upx; do file $f; done for f in ./build/extra/*/*/upx; do file $f; done
jobs="clang/debug clang/release" jobs="clang/debug clang/release"
@@ -378,6 +395,7 @@ jobs:
echo "===== parallel jobs: $jobs" echo "===== parallel jobs: $jobs"
CTEST_JOBS=2 parallel -kv --lb 'make build/extra/{}+test' ::: $jobs CTEST_JOBS=2 parallel -kv --lb 'make build/extra/{}+test' ::: $jobs
- name: Mimic ctest tests - name: Mimic ctest tests
if: ${{ matrix.testsuite }}
run: | run: |
export PATH="$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$PATH" export PATH="$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$PATH"
jobs="clang/debug clang/release" jobs="clang/debug clang/release"
@@ -385,7 +403,7 @@ jobs:
echo "===== parallel jobs: $jobs" echo "===== parallel jobs: $jobs"
parallel -kv --lb 'cd build/extra/{} && bash ../../../../misc/testsuite/mimic_ctest.sh' ::: $jobs parallel -kv --lb 'cd build/extra/{} && bash ../../../../misc/testsuite/mimic_ctest.sh' ::: $jobs
- name: Run file system tests - name: Run file system tests
if: ${{ matrix.testsuite }} # for coreutils readlink if: ${{ matrix.testsuite }}
run: | run: |
export PATH="$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$PATH" export PATH="$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$PATH"
export upx_test_file="$PWD"/build/extra/clang/release/upx export upx_test_file="$PWD"/build/extra/clang/release/upx
@@ -410,20 +428,18 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
include: include:
# { name: windows-2019-amd64, os: windows-2019, vsversion: 2019, vsarch: amd64 } - { name: windows-11-arm64, os: windows-11-arm, vsversion: 2022, vsarch: arm64 }
- { name: windows-2022-amd64, os: windows-2022, vsversion: 2022, vsarch: amd64 } - { name: windows-11-arm64ec, os: windows-11-arm, vsversion: 2022, vsarch: arm64, use_arm64ec: true }
- { name: windows-2022-arm64, os: windows-2022, vsversion: 2022, vsarch: amd64_arm64 } # { name: windows-11-arm64x, os: windows-11-arm, vsversion: 2022, vsarch: arm64, use_arm64x: true }
# { name: windows-2022-arm64ec, os: windows-2022, vsversion: 2022, vsarch: amd64_arm64, use_arm64ec: true } - { name: windows-2022-amd64, os: windows-2022, vsversion: 2022, vsarch: amd64 }
- { name: windows-2022-i386, os: windows-2022, vsversion: 2022, vsarch: amd64_x86 } - { name: windows-2022-i386, os: windows-2022, vsversion: 2022, vsarch: amd64_x86 }
- { name: windows-2025-amd64, os: windows-2025, vsversion: 2022, vsarch: amd64 } - { name: windows-2025-amd64, os: windows-2025, vsversion: 2022, vsarch: amd64 }
- { name: windows-2025-arm64, os: windows-2025, vsversion: 2022, vsarch: amd64_arm64 } - { name: windows-2025-i386, os: windows-2025, vsversion: 2022, vsarch: amd64_x86 }
- { name: windows-2025-arm64ec, os: windows-2025, vsversion: 2022, vsarch: amd64_arm64, use_arm64ec: true }
- { name: windows-2025-i386, os: windows-2025, vsversion: 2022, vsarch: amd64_x86 }
name: ${{ format('{0}', matrix.name) }} name: ${{ format('{0}', matrix.name) }}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- run: git config --global core.autocrlf false - run: git config --global core.autocrlf false
- uses: actions/checkout@v5 - uses: actions/checkout@v6
with: { submodules: true } with: { submodules: true }
- name: Check out test suite - name: Check out test suite
run: git clone --depth=1 https://github.com/upx/upx-testsuite ../deps/upx-testsuite run: git clone --depth=1 https://github.com/upx/upx-testsuite ../deps/upx-testsuite
@@ -431,16 +447,21 @@ jobs:
with: { vsversion: '${{ matrix.vsversion }}', arch: '${{ matrix.vsarch }}' } with: { vsversion: '${{ matrix.vsversion }}', arch: '${{ matrix.vsarch }}' }
- name: Set platform - name: Set platform
run: | run: |
if [[ "${{ matrix.vsarch }}" == amd64 ]]; then true; if [[ "${{ matrix.use_arm64ec }}" == "true" ]]; then true;
echo "UPX_CMAKE_CONFIG_FLAGS_PLATFORM=-A x64" >> $GITHUB_ENV
elif [[ "${{ matrix.use_arm64ec }}" == "true" ]]; then true;
echo "UPX_CMAKE_CONFIG_FLAGS_PLATFORM=-A ARM64EC" >> $GITHUB_ENV echo "UPX_CMAKE_CONFIG_FLAGS_PLATFORM=-A ARM64EC" >> $GITHUB_ENV
echo "UPX_CONFIG_DISABLE_SELF_PACK_TEST=ON" >> $GITHUB_ENV echo "UPX_CONFIG_DISABLE_SELF_PACK_TEST=ON" >> $GITHUB_ENV
elif [[ "${{ matrix.vsarch }}" == amd64_arm64 ]]; then true; elif [[ "${{ matrix.use_arm64x }}" == "true" ]]; then true;
echo "UPX_CMAKE_CONFIG_FLAGS_PLATFORM=-A ARM64X" >> $GITHUB_ENV
echo "UPX_CONFIG_DISABLE_SELF_PACK_TEST=ON" >> $GITHUB_ENV
elif [[ "${{ matrix.vsarch }}" == *amd64 ]]; then true;
echo "UPX_CMAKE_CONFIG_FLAGS_PLATFORM=-A x64" >> $GITHUB_ENV
elif [[ "${{ matrix.vsarch }}" == *arm64 ]]; then true;
echo "UPX_CMAKE_CONFIG_FLAGS_PLATFORM=-A ARM64" >> $GITHUB_ENV echo "UPX_CMAKE_CONFIG_FLAGS_PLATFORM=-A ARM64" >> $GITHUB_ENV
echo "UPX_CONFIG_DISABLE_SELF_PACK_TEST=ON" >> $GITHUB_ENV echo "UPX_CONFIG_DISABLE_SELF_PACK_TEST=ON" >> $GITHUB_ENV
elif [[ "${{ matrix.vsarch }}" == amd64_x86 ]]; then true; elif [[ "${{ matrix.vsarch }}" == *x86 ]]; then true;
echo "UPX_CMAKE_CONFIG_FLAGS_PLATFORM=-A Win32" >> $GITHUB_ENV echo "UPX_CMAKE_CONFIG_FLAGS_PLATFORM=-A Win32" >> $GITHUB_ENV
else
exit 1
fi fi
- run: make build/debug - run: make build/debug
- run: make build/release - run: make build/release
@@ -459,50 +480,45 @@ jobs:
cmake --install build/debug --config Debug --prefix "$PWD/tmp/artifact/$N/InstallWithCMake/InstallWithPrefixAndStrip/debug" --strip cmake --install build/debug --config Debug --prefix "$PWD/tmp/artifact/$N/InstallWithCMake/InstallWithPrefixAndStrip/debug" --strip
cmake --install build/release --config Release --prefix "$PWD/tmp/artifact/$N/InstallWithCMake/InstallWithPrefixAndStrip/release" --strip cmake --install build/release --config Release --prefix "$PWD/tmp/artifact/$N/InstallWithCMake/InstallWithPrefixAndStrip/release" --strip
(cd build && cp -ai --parents */*/upx.exe "../tmp/artifact/$N") (cd build && cp -ai --parents */*/upx.exe "../tmp/artifact/$N")
(cd tmp/artifact && tar --sort=name --zstd -cf "$N.tar.zst" "$N" && rm -rf "./$N" && ls -la && zstd -tq "$N.tar.zst") #(cd tmp/artifact && tar --sort=name --zstd -cf "$N.tar.zst" "$N" && rm -rf "./$N" && ls -la && zstd -tq "$N.tar.zst")
(cd tmp/artifact && tar --sort=name --gzip -cf "$N.tar.gz" "$N" && rm -rf "./$N" && ls -la && gzip -tq "$N.tar.gz")
echo "artifact_name=$N" >> $GITHUB_ENV echo "artifact_name=$N" >> $GITHUB_ENV
- name: ${{ format('Upload artifact {0}', env.artifact_name) }} - name: ${{ format('Upload artifact {0}', env.artifact_name) }}
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v5
with: { name: '${{ env.artifact_name }}', path: tmp/artifact } with: { name: '${{ env.artifact_name }}', path: tmp/artifact }
- name: Run ctest tests - name: Run ctest tests
if: ${{ matrix.vsarch != 'amd64_arm64' }}
run: | run: |
ctest --test-dir build/debug --parallel 8 -C Debug ctest --test-dir build/debug --parallel 8 -C Debug
ctest --test-dir build/release --parallel 8 -C Release ctest --test-dir build/release --parallel 8 -C Release
- name: Mimic ctest tests - name: Mimic ctest tests
if: ${{ matrix.vsarch != 'amd64_arm64' }}
run: | run: |
env -C build/debug/Debug upx_exe=./upx.exe bash "$PWD"/misc/testsuite/mimic_ctest.sh env -C build/debug/Debug upx_exe=./upx.exe bash "$PWD"/misc/testsuite/mimic_ctest.sh
env -C build/release/Release upx_exe=./upx.exe bash "$PWD"/misc/testsuite/mimic_ctest.sh env -C build/release/Release upx_exe=./upx.exe bash "$PWD"/misc/testsuite/mimic_ctest.sh
- name: Run test suite build/release - name: Run test suite build/release
if: ${{ matrix.vsarch != 'amd64_arm64' }}
run: | run: |
export upx_testsuite_SRCDIR="$(readlink -en ../deps/upx-testsuite)" export upx_testsuite_SRCDIR="$(readlink -en ../deps/upx-testsuite)"
env -C build/release/Release upx_exe=./upx.exe bash "$PWD"/misc/testsuite/upx_testsuite_1.sh env -C build/release/Release upx_exe=./upx.exe bash "$PWD"/misc/testsuite/upx_testsuite_1.sh
job-windows-toolchains: # build "by hand" using cmd.exe job-windows-bh-toolchains: # build "by hand" using cmd.exe
if: github.repository_owner == 'upx' if: github.repository_owner == 'upx'
needs: [ job-rebuild-and-verify-stubs ] needs: [ job-rebuild-and-verify-stubs ]
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
include: include:
# { name: amd64-win64-vs2019, os: windows-2019, vsversion: 2019, vsarch: amd64 } - { name: amd64-win64-vs2025, os: windows-2025, vsversion: 2022, vsarch: amd64 }
- { name: amd64-win64-vs2022, os: windows-2022, vsversion: 2022, vsarch: amd64 } - { name: arm64-win64-vs2025, os: windows-2025, vsversion: 2022, vsarch: amd64_arm64 }
# { name: arm64-win64-vs2019, os: windows-2019, vsversion: 2019, vsarch: amd64_arm64 } - { name: arm64ec-win64-vs2025, os: windows-2025, vsversion: 2022, vsarch: amd64_arm64, cl_machine_flags: -arm64EC, link_machine_flags: '/machine:arm64ec' }
- { name: arm64-win64-vs2022, os: windows-2022, vsversion: 2022, vsarch: amd64_arm64 } # { name: arm64x-win64-vs2025, os: windows-2025, vsversion: 2022, vsarch: amd64_arm64, cl_machine_flags: -arm64EC, link_machine_flags: '/machine:arm64x' }
- { name: arm64ec-win64-vs2022, os: windows-2022, vsversion: 2022, vsarch: amd64_arm64, cl_machine_flags: -arm64EC, link_machine_flags: '/machine:arm64ec' } - { name: i386-win32-vs2025, os: windows-2025, vsversion: 2022, vsarch: amd64_x86 }
# { name: arm64x-win64-vs2022, os: windows-2022, vsversion: 2022, vsarch: amd64_arm64, cl_machine_flags: -arm64EC, link_machine_flags: '/machine:arm64x' } name: ${{ format('windows-bh {0}', matrix.name) }}
# { name: i386-win32-vs2019, os: windows-2019, vsversion: 2019, vsarch: amd64_x86 }
- { name: i386-win32-vs2022, os: windows-2022, vsversion: 2022, vsarch: amd64_x86 }
name: ${{ format('windows {0}', matrix.name) }}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
env: env:
C: ${{ matrix.name }} C: ${{ matrix.name }}
B: release B: release
steps: steps:
- run: git config --global core.autocrlf false - run: git config --global core.autocrlf false
- uses: actions/checkout@v5 - uses: actions/checkout@v6
with: { submodules: true } with: { submodules: true }
- name: Prepare sources and Check out test suite - name: Prepare sources and Check out test suite
run: | run: |
@@ -556,13 +572,14 @@ jobs:
- run: shopt -s globstar; file build/**/upx* || true - run: shopt -s globstar; file build/**/upx* || true
- name: Make artifact - name: Make artifact
run: | run: |
N=$(echo "upx-${GITHUB_REF_NAME}-${GITHUB_SHA:0:7}-windows-${{ matrix.name }}" | sed 's/[^0-9a-zA-Z_.-]/-/g') N=$(echo "upx-${GITHUB_REF_NAME}-${GITHUB_SHA:0:7}-windows-bh-${{ matrix.name }}" | sed 's/[^0-9a-zA-Z_.-]/-/g')
mkdir -p "tmp/artifact/$N/$B" mkdir -p "tmp/artifact/$N/$B"
cp -ai build/$C/$B/upx/upx*.exe "tmp/artifact/$N/$B" cp -ai build/$C/$B/upx/upx*.exe "tmp/artifact/$N/$B"
(cd tmp/artifact && tar --sort=name --zstd -cf "$N.tar.zst" "$N" && rm -rf "./$N" && ls -la && zstd -tq "$N.tar.zst") #(cd tmp/artifact && tar --sort=name --zstd -cf "$N.tar.zst" "$N" && rm -rf "./$N" && ls -la && zstd -tq "$N.tar.zst")
(cd tmp/artifact && tar --sort=name --gzip -cf "$N.tar.gz" "$N" && rm -rf "./$N" && ls -la && gzip -tq "$N.tar.gz")
echo "artifact_name=$N" >> $GITHUB_ENV echo "artifact_name=$N" >> $GITHUB_ENV
- name: ${{ format('Upload artifact {0}', env.artifact_name) }} - name: ${{ format('Upload artifact {0}', env.artifact_name) }}
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v5
with: { name: '${{ env.artifact_name }}', path: tmp/artifact } with: { name: '${{ env.artifact_name }}', path: tmp/artifact }
- name: Mimic ctest tests - name: Mimic ctest tests
if: ${{ matrix.vsarch != 'amd64_arm64' }} if: ${{ matrix.vsarch != 'amd64_arm64' }}
@@ -606,6 +623,8 @@ jobs:
- { zig_target: powerpc64-linux-musl, qemu: qemu-ppc64, zig_pic: -fPIE } - { zig_target: powerpc64-linux-musl, qemu: qemu-ppc64, zig_pic: -fPIE }
- { zig_target: powerpc64le-linux-musl, qemu: qemu-ppc64le } - { zig_target: powerpc64le-linux-musl, qemu: qemu-ppc64le }
- { zig_target: powerpc64le-linux-musl, qemu: qemu-ppc64le, zig_pic: -fPIE } - { zig_target: powerpc64le-linux-musl, qemu: qemu-ppc64le, zig_pic: -fPIE }
- { zig_target: riscv64-linux-musl, qemu: qemu-riscv64, tt: UPX-UNSUPPORTED }
- { zig_target: riscv64-linux-musl, qemu: qemu-riscv64, tt: UPX-UNSUPPORTED, zig_pic: -fPIE }
- { zig_target: x86_64-linux-gnu.2.3.4, qemu: qemu-x86_64 } # can use QEMU because of gcompat - { zig_target: x86_64-linux-gnu.2.3.4, qemu: qemu-x86_64 } # can use QEMU because of gcompat
- { zig_target: x86_64-linux-gnu.2.17, qemu: qemu-x86_64 } # can use QEMU because of gcompat - { zig_target: x86_64-linux-gnu.2.17, qemu: qemu-x86_64 } # can use QEMU because of gcompat
- { zig_target: x86_64-linux-musl, qemu: qemu-x86_64 } - { zig_target: x86_64-linux-musl, qemu: qemu-x86_64 }
@@ -614,9 +633,9 @@ jobs:
- { zig_target: x86_64-windows-gnu } - { zig_target: x86_64-windows-gnu }
name: ${{ format('zigcc {0} {1}', matrix.zig_target, matrix.zig_pic) }} name: ${{ format('zigcc {0} {1}', matrix.zig_target, matrix.zig_pic) }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: ${{ matrix.container || 'alpine:3.22' }} container: ${{ matrix.container || 'alpine:3.23' }}
env: env:
container: ${{ matrix.container || 'alpine:3.22' }} container: ${{ matrix.container || 'alpine:3.23' }}
UPX_CONFIG_HAVE_WORKING_BUILD_RPATH: '' UPX_CONFIG_HAVE_WORKING_BUILD_RPATH: ''
# for zig-cc wrapper scripts (see below): # for zig-cc wrapper scripts (see below):
ZIG_CPPFLAGS: -DUPX_DOCTEST_CONFIG_MULTITHREADING ZIG_CPPFLAGS: -DUPX_DOCTEST_CONFIG_MULTITHREADING
@@ -635,7 +654,7 @@ jobs:
git config --global --add safe.directory '*' # needed when running in a container git config --global --add safe.directory '*' # needed when running in a container
mkdir -p ~/.parallel && : > ~/.parallel/$(echo 6305-4721 | tr 0-7 leticlwi) mkdir -p ~/.parallel && : > ~/.parallel/$(echo 6305-4721 | tr 0-7 leticlwi)
- run: (sudo dmidecode | sed -n -e '/System Information/,/^$/p') || true - run: (sudo dmidecode | sed -n -e '/System Information/,/^$/p') || true
- uses: actions/checkout@v5 - uses: actions/checkout@v6
with: { submodules: true } with: { submodules: true }
- name: ${{ format('Install Zig {0}', env.ZIG_DIST_VERSION) }} - name: ${{ format('Install Zig {0}', env.ZIG_DIST_VERSION) }}
run: | run: |
@@ -649,14 +668,16 @@ jobs:
# TODO FIXME: problem with self-packed upx and musl+gcompat: "Not a valid dynamic program" # TODO FIXME: problem with self-packed upx and musl+gcompat: "Not a valid dynamic program"
echo "UPX_CONFIG_DISABLE_RUN_PACKED_TEST=ON" >> $GITHUB_ENV echo "UPX_CONFIG_DISABLE_RUN_PACKED_TEST=ON" >> $GITHUB_ENV
fi fi
test -z "${{ matrix.tt }}" || echo "UPX_CONFIG_DISABLE_SELF_PACK_TEST=ON" >> $GITHUB_ENV
# install zig; note that ~/.local/bin is included in the default $PATH on Ubuntu # install zig; note that ~/.local/bin is included in the default $PATH on Ubuntu
mkdir -p -v ~/.local/bin mkdir -p -v ~/.local/bin
cd ~/.local/bin cd ~/.local/bin
ZIG_DIST_VERSION=${ZIG_DIST_VERSION/#zig-/}
ZIG_DIST_NAME=zig-linux-x86_64-${ZIG_DIST_VERSION} ZIG_DIST_NAME=zig-linux-x86_64-${ZIG_DIST_VERSION}
ZIG_DIST_NAME=zig-x86_64-linux-${ZIG_DIST_VERSION} ZIG_DIST_NAME=zig-x86_64-linux-${ZIG_DIST_VERSION}
#curl -sS -L -O https://ziglang.org/builds/${ZIG_DIST_NAME}.tar.xz #curl -sS -L -O https://ziglang.org/builds/${ZIG_DIST_NAME}.tar.xz
#curl -sS -L -O https://ziglang.org/download/0.14.1/${ZIG_DIST_NAME}.tar.xz #curl -sS -L -O https://ziglang.org/download/0.14.1/${ZIG_DIST_NAME}.tar.xz
curl -sS -L -O https://ziglang.org/download/0.15.1/${ZIG_DIST_NAME}.tar.xz curl -sS -L -O https://ziglang.org/download/0.15.2/${ZIG_DIST_NAME}.tar.xz
ls -l ${ZIG_DIST_NAME}.tar.xz ls -l ${ZIG_DIST_NAME}.tar.xz
file ${ZIG_DIST_NAME}.tar.xz || true file ${ZIG_DIST_NAME}.tar.xz || true
tar -xoJf ${ZIG_DIST_NAME}.tar.xz tar -xoJf ${ZIG_DIST_NAME}.tar.xz
@@ -731,7 +752,7 @@ jobs:
(cd tmp/artifact && tar --sort=name --zstd -cf "$N.tar.zst" "$N" && rm -rf "./$N" && ls -la && zstd -tq "$N.tar.zst") (cd tmp/artifact && tar --sort=name --zstd -cf "$N.tar.zst" "$N" && rm -rf "./$N" && ls -la && zstd -tq "$N.tar.zst")
echo "artifact_name=$N" >> $GITHUB_ENV echo "artifact_name=$N" >> $GITHUB_ENV
- name: ${{ format('Upload artifact {0}', env.artifact_name) }} - name: ${{ format('Upload artifact {0}', env.artifact_name) }}
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v5
with: { name: '${{ env.artifact_name }}', path: tmp/artifact } with: { name: '${{ env.artifact_name }}', path: tmp/artifact }
- name: Run install tests - name: Run install tests
if: ${{ contains(matrix.zig_target, '-linux') }} if: ${{ contains(matrix.zig_target, '-linux') }}
+4 -4
View File
@@ -57,14 +57,14 @@ endif()
# test config options (see below) # test config options (see below)
# IMPORTANT NOTE: self-pack test can only work if the host executable format is supported by UPX! # IMPORTANT NOTE: self-pack test can only work if the host executable format is supported by UPX!
option(UPX_CONFIG_DISABLE_SELF_PACK_TEST "Do not test packing UPX with itself" OFF) option(UPX_CONFIG_DISABLE_SELF_PACK_TEST "Do not test packing UPX with itself." OFF)
option(UPX_CONFIG_DISABLE_EXHAUSTIVE_TESTS "Do not run exhaustive tests" OFF) option(UPX_CONFIG_DISABLE_EXHAUSTIVE_TESTS "Do not run exhaustive tests." OFF)
#*********************************************************************** #***********************************************************************
# init # init
#*********************************************************************** #***********************************************************************
set(UPX_VERSION_STRING "5.0.3") # this should match src/version.h set(UPX_VERSION_STRING "5.1.0") # this should match src/version.h
upx_cmake_include_hook(2_init) upx_cmake_include_hook(2_init)
@@ -289,7 +289,7 @@ if(Threads_FOUND)
if(NOT result) if(NOT result)
# failed; under MinGW be sure to use the posix-threads and NOT the win32-threads version # failed; under MinGW be sure to use the posix-threads and NOT the win32-threads version
if(UPX_CONFIG_REQUIRE_THREADS OR (UPX_CONFIG_EXPECT_THREADS AND NOT UPX_CONFIG_DISABLE_THREADS)) if(UPX_CONFIG_REQUIRE_THREADS OR (UPX_CONFIG_EXPECT_THREADS AND NOT UPX_CONFIG_DISABLE_THREADS))
message(WARNING "Threads FAILED ${f}: ${output}") # output from try_compile message(WARNING "Threads FAILED ${f}: ${output}") # output from try_compile()
endif() endif()
set(Threads_FOUND OFF) set(Threads_FOUND OFF)
break() break()
+2
View File
@@ -104,3 +104,5 @@ check-whitespace clang-format run-testsuite run-testsuite-all run-testsuite-debu
$(MAKE) -C src $@ $(MAKE) -C src $@
endif endif
endif endif
# vim:set ts=8 sw=8 noet:
+1 -1
View File
@@ -2,7 +2,7 @@
User visible changes for UPX User visible changes for UPX
================================================================== ==================================================================
Changes in 5.0.3 (XX XXX XXXX): Changes in 5.1.0 (XX XXX XXXX):
* bug fixes - see https://github.com/upx/upx/milestone/21 * bug fixes - see https://github.com/upx/upx/milestone/21
Changes in 5.0.2 (20 Jul 2025): Changes in 5.0.2 (20 Jul 2025):
+3 -2
View File
@@ -61,8 +61,9 @@ SHORT DOCUMENTATION
'upx program.exe' will compress a program or DLL. For best compression 'upx program.exe' will compress a program or DLL. For best compression
results try 'upx --best program.exe' or 'upx --brute program.exe'. results try 'upx --best program.exe' or 'upx --brute program.exe'.
Please see the file UPX.DOC for the full documentation. The files Please see the file doc/upx-doc.txt for the full documentation. The files
NEWS and BUGS also contain various tidbits of information. NEWS and doc/BUGS.txt also contain various tidbits of information, as
does the output of 'upx --help'.
THE FUTURE THE FUTURE
+21 -1
View File
@@ -81,6 +81,15 @@ Developer quick start
4b) $ wget https://github.com/upx/upx-stubtools/releases/download/v20221212/bin-upx-20221212.tar.xz 4b) $ wget https://github.com/upx/upx-stubtools/releases/download/v20221212/bin-upx-20221212.tar.xz
# Extract to $HOME/bin/bin-upx or $HOME/local/bin/bin-upx. # Extract to $HOME/bin/bin-upx or $HOME/local/bin/bin-upx.
# See directions in: https://github.com/upx/upx-stubtools # See directions in: https://github.com/upx/upx-stubtools
# Some of the pre-built tools need i386 libz. On Ubuntu:
# # dpkg --add-architecture i386
# # apt-get update
# # apt-get install zlib1g-dev
# aarch64-linux-gnu/4.9.2/cc1 needs libmpfr.so.4. Make a symlink:
# # ln -s /usr/lib/x86_64-linux-gnu/libmpfr.so.6 /usr/lib/x86_64-linux-gnu/libmpfr.so.4
4c) $ make clean; make # verify that you can re-build stubs 4c) $ make clean; make # verify that you can re-build stubs
4d) $ popd # my-upx 4d) $ popd # my-upx
5) $ cd upx # my-upx/upx 5) $ cd upx # my-upx/upx
@@ -92,7 +101,18 @@ Developer quick start
# If stuck, then reset via "rm -rf vendor; git submodule update --init". # If stuck, then reset via "rm -rf vendor; git submodule update --init".
7) $ mkdir -p build/debug build/release 7) $ mkdir -p build/debug build/release
8) $ pushd build/debug # my-upx/upx/build/debug 8) $ pushd build/debug # my-upx/upx/build/debug
9) $ cmake ../.. # configure cmake
9a) Install GNU g++ so that it is used when invoking "c++" compiler.
On Ubuntu 24.04 with
cmake: cmake version 3.28.3
g++: Ubuntu clang version 18.1.3 (1ubuntu1)
/lib/llvm-18/lib/cmake/llvm/HandleLLVMOptions.cmake:
add_flag_if_supported("-fno-lifetime-dse" CMAKE_CXX_FLAGS)
then cmake invoking c++ uses -fno-lifetime-dse but gets
c++: error: unknown argument: '-fno-lifetime-dse'
Commenting out the "add_flag_if_supported' line still uses that unknown argument.
Installing g++ avoids the problem.
9b) $ cmake ../.. # configure cmake
10) $ cmake --build . --verbose # optional "--verbose" 10) $ cmake --build . --verbose # optional "--verbose"
# This relies on stub/*.h, which YOU must re-build if necessary. # This relies on stub/*.h, which YOU must re-build if necessary.
# When in doubt, then use "cd src/stub; make clean; make". # When in doubt, then use "cd src/stub; make clean; make".
Generated
+1 -1
View File
@@ -55,7 +55,7 @@
.\" ======================================================================== .\" ========================================================================
.\" .\"
.IX Title "UPX 1" .IX Title "UPX 1"
.TH UPX 1 2025-07-21 "upx 5.0.3" " " .TH UPX 1 2025-10-24 "upx 5.1.0" " "
.\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents. .\" way too many mistakes in technical documents.
.if n .ad l .if n .ad l
+4 -1
View File
@@ -281,6 +281,7 @@ build/analyze/clang-tidy/debug build/analyze/clang-tidy/release: build/analyze/c
build/analyze/clang-tidy/debug build/analyze/clang-tidy/release: build/analyze/clang-tidy-ucl/$$(notdir $$@) build/analyze/clang-tidy/debug build/analyze/clang-tidy/release: build/analyze/clang-tidy-ucl/$$(notdir $$@)
build/analyze/clang-tidy/debug build/analyze/clang-tidy/release: build/analyze/clang-tidy-zlib/$$(notdir $$@) build/analyze/clang-tidy/debug build/analyze/clang-tidy/release: build/analyze/clang-tidy-zlib/$$(notdir $$@)
build/analyze/clang-tidy/debug build/analyze/clang-tidy/release: build/analyze/clang-tidy-zstd/$$(notdir $$@) build/analyze/clang-tidy/debug build/analyze/clang-tidy/release: build/analyze/clang-tidy-zstd/$$(notdir $$@)
build/analyze/clang-tidy/debug build/analyze/clang-tidy/release: PHONY
# OLD names [deprecated] # OLD names [deprecated]
build/extra/scan-build/debug: build/analyze/clang-analyzer/debug PHONY build/extra/scan-build/debug: build/analyze/clang-analyzer/debug PHONY
@@ -377,6 +378,8 @@ UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_EXTRA_COMPILE_OPT
SUBMODULES = doctest lzma-sdk ucl valgrind zlib SUBMODULES = doctest lzma-sdk ucl valgrind zlib
$(foreach 1,$(SUBMODULES),$(if $(wildcard vendor/$1/[CL]*),,\ $(foreach 1,$(SUBMODULES),$(if $(wildcard vendor/$1/[CL]*),,\
$(error ERROR: missing git submodule '$1'; run 'git submodule update --init'))) $(error ERROR: missing git submodule '$1'; run 'git submodule update --init')))
endif # UPX_MAKEFILE_EXTRA_MK_INCLUDED endif # UPX_MAKEFILE_EXTRA_MK_INCLUDED
# vim:set ts=8 sw=8 noet:
+2 -1
View File
@@ -11,12 +11,13 @@ diff --git a/lib/libcxx/include/__config b/lib/libcxx/include/__config
index fec323f..a16d145 100644 index fec323f..a16d145 100644
--- a/lib/libcxx/include/__config --- a/lib/libcxx/include/__config
+++ b/lib/libcxx/include/__config +++ b/lib/libcxx/include/__config
@@ -637,9 +637,11 @@ typedef __char32_t char32_t; @@ -637,9 +637,12 @@ typedef __char32_t char32_t;
# define _DECLARE_C99_LDBL_MATH 1 # define _DECLARE_C99_LDBL_MATH 1
# endif # endif
+# if defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION) +# if defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION)
+# define _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION 0 +# define _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION 0
+# elif defined(_LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION)
// If we are getting operator new from the MSVC CRT, then allocation overloads // If we are getting operator new from the MSVC CRT, then allocation overloads
// for align_val_t were added in 19.12, aka VS 2017 version 15.3. // for align_val_t were added in 19.12, aka VS 2017 version 15.3.
-# if defined(_LIBCPP_MSVCRT) && defined(_MSC_VER) && _MSC_VER < 1912 -# if defined(_LIBCPP_MSVCRT) && defined(_MSC_VER) && _MSC_VER < 1912
+4 -2
View File
@@ -9,7 +9,7 @@ RUN dpkg --add-architecture i386 \
&& apt-get update && apt-get upgrade -y \ && apt-get update && apt-get upgrade -y \
&& apt-get install -y --no-install-recommends \ && apt-get install -y --no-install-recommends \
aria2 bash bash-completion ca-certificates coreutils curl diffutils findutils git grep gzip \ aria2 bash bash-completion ca-certificates coreutils curl diffutils findutils git grep gzip \
less libmpc3 make ncurses-term perl-base sed sudo tar time util-linux wget xz-utils \ less libmpc3 make ncurses-term perl-base python3 sed sudo tar time util-linux wget xz-utils \
libc6:i386 zlib1g:i386 \ libc6:i386 zlib1g:i386 \
# the following packages are not required for rebuilding the stubs, but # the following packages are not required for rebuilding the stubs, but
# they do make the image *much* more convenient and also allow building # they do make the image *much* more convenient and also allow building
@@ -19,12 +19,14 @@ RUN dpkg --add-architecture i386 \
g++ gawk gdb gh gojq ht htop hyperfine jq just ksh \ g++ gawk gdb gh gojq ht htop hyperfine jq just ksh \
lftp libzstd-dev lsb-release lsd lz4 lzip lzop minify mksh moreutils musl neovim ninja-build \ lftp libzstd-dev lsb-release lsd lz4 lzip lzop minify mksh moreutils musl neovim ninja-build \
p7zip parallel patch patchelf patchutils pax-utils proot \ p7zip parallel patch patchelf patchutils pax-utils proot \
python3 python3-pyasn1 python3-pycryptodome python3-pycurl python3-tomli python3-tomli-w \ python3-pyasn1 python3-pycryptodome python3-pycurl python3-tomli python3-tomli-w \
python3-yaml python3-zstd \ python3-yaml python3-zstd \
re2c ripgrep rsync screen socat strace universal-ctags unzip valgrind yash yq \ re2c ripgrep rsync screen socat strace universal-ctags unzip valgrind yash yq \
zip zlib1g-dev zoxide zsh zstd \ zip zlib1g-dev zoxide zsh zstd \
# extra packages for compiling with "gcc -m32" and "gcc -mx32": # extra packages for compiling with "gcc -m32" and "gcc -mx32":
g++-multilib gcc-multilib \ g++-multilib gcc-multilib \
&& apt-get install -y \
gcc-riscv64-linux-gnu \
&& true && true
# install python2-minimal packages from Debian-11; REQUIRED # install python2-minimal packages from Debian-11; REQUIRED
+436 -385
View File
@@ -1,396 +1,432 @@
REPOSITORY TAG IMAGE ID CREATED SIZE
localhost/upx-stubtools-20240405-v1 latest e35ec64e37eb 3 minutes ago 1.62 GB
Image ID: e35ec64e37eb
Tags: [localhost/upx-stubtools-20240405-v1:latest]
Size: 1.616GB
Image Layers
├── ID: 073ec47a8c22 Size: 80.63MB Top Layer of: [docker.io/library/ubuntu:24.04]
├── ID: cc32efc504cb Size: 1.168GB
├── ID: 0ad248142047 Size: 9.477MB
├── ID: 1b5f23a7b45a Size: 457.2kB
├── ID: fde08588dc3b Size: 320.1MB
├── ID: 028612b01bc7 Size: 37.45MB
└── ID: a8359823a285 Size: 44.03kB Top Layer of: [localhost/upx-stubtools-20240405-v1:latest]
Packages: Packages:
+++-=============================-=================================-============-================================================================================ +++-===================================-=================================-============-================================================================================
Desired=Unknown/Install/Remove/Purge/Hold Desired=Unknown/Install/Remove/Purge/Hold
ii 7zip 23.01+dfsg-11 amd64 7-Zip file archiver with a high compression ratio ii 7zip 23.01+dfsg-11 amd64 7-Zip file archiver with a high compression ratio
ii apt 2.8.3 amd64 commandline package manager ii apt 2.8.3 amd64 commandline package manager
ii aria2 1.37.0+debian-1build3 amd64 High speed download utility ii aria2 1.37.0+debian-1build3 amd64 High speed download utility
ii base-files 13ubuntu10.2 amd64 Debian base system miscellaneous files ii base-files 13ubuntu10.3 amd64 Debian base system miscellaneous files
ii base-passwd 3.6.3build1 amd64 Debian base system master password and group files ii base-passwd 3.6.3build1 amd64 Debian base system master password and group files
ii bash 5.2.21-2ubuntu4 amd64 GNU Bourne Again SHell ii bash 5.2.21-2ubuntu4 amd64 GNU Bourne Again SHell
ii bash-completion 1:2.11-8 all programmable completion for the bash shell ii bash-completion 1:2.11-8 all programmable completion for the bash shell
ii bat 0.24.0-1build1 amd64 cat(1) clone with syntax highlighting and git integration ii bat 0.24.0-1build1 amd64 cat(1) clone with syntax highlighting and git integration
ii bfs 3.1.2-1build1 amd64 Breadth-first version of find(1) ii bfs 3.1.2-1build1 amd64 Breadth-first version of find(1)
ii binutils 2.42-4ubuntu2.5 amd64 GNU assembler, linker and binary utilities ii binutils 2.42-4ubuntu2.6 amd64 GNU assembler, linker and binary utilities
ii binutils-common:amd64 2.42-4ubuntu2.5 amd64 Common files for the GNU assembler, linker and binary utilities ii binutils-common:amd64 2.42-4ubuntu2.6 amd64 Common files for the GNU assembler, linker and binary utilities
ii binutils-x86-64-linux-gnu 2.42-4ubuntu2.5 amd64 GNU binary utilities, for x86-64-linux-gnu target ii binutils-riscv64-linux-gnu 2.42-4ubuntu2.6 amd64 GNU binary utilities, for riscv64-linux-gnu target
ii bsdextrautils 2.39.3-9ubuntu6.3 amd64 extra utilities from 4.4BSD-Lite ii binutils-x86-64-linux-gnu 2.42-4ubuntu2.6 amd64 GNU binary utilities, for x86-64-linux-gnu target
ii bsdutils 1:2.39.3-9ubuntu6.3 amd64 basic utilities from 4.4BSD-Lite ii bsdextrautils 2.39.3-9ubuntu6.3 amd64 extra utilities from 4.4BSD-Lite
ii btop 1.3.0-1 amd64 Modern and colorful command line resource monitor that shows usage and stats ii bsdutils 1:2.39.3-9ubuntu6.3 amd64 basic utilities from 4.4BSD-Lite
ii bubblewrap 0.9.0-1ubuntu0.1 amd64 utility for unprivileged chroot and namespace manipulation ii btop 1.3.0-1 amd64 Modern and colorful command line resource monitor that shows usage and stats
ii busybox 1:1.36.1-6ubuntu3.1 amd64 Tiny utilities for small and embedded systems ii bubblewrap 0.9.0-1ubuntu0.1 amd64 utility for unprivileged chroot and namespace manipulation
ii bzip2 1.0.8-5.1build0.1 amd64 high-quality block-sorting file compressor - utilities ii busybox 1:1.36.1-6ubuntu3.1 amd64 Tiny utilities for small and embedded systems
ii bzip3 1.4.0-1 amd64 better, faster and stronger spiritual successor to bzip2 - utilities ii bzip2 1.0.8-5.1build0.1 amd64 high-quality block-sorting file compressor - utilities
ii ca-certificates 20240203 all Common CA certificates ii bzip3 1.4.0-1 amd64 better, faster and stronger spiritual successor to bzip2 - utilities
ii cabextract 1.11-2 amd64 Microsoft Cabinet file unpacker ii ca-certificates 20240203 all Common CA certificates
ii ccache 4.9.1-1 amd64 Compiler cache for fast recompilation of C/C++ code ii cabextract 1.11-2 amd64 Microsoft Cabinet file unpacker
ii chrpath 0.16-2build1 amd64 Tool to edit the rpath in ELF binaries ii ccache 4.9.1-1 amd64 Compiler cache for fast recompilation of C/C++ code
ii cmake 3.28.3-1build7 amd64 cross-platform, open-source make system ii chrpath 0.16-2build1 amd64 Tool to edit the rpath in ELF binaries
ii cmake-data 3.28.3-1build7 all CMake data files (modules, templates and documentation) ii cmake 3.28.3-1build7 amd64 cross-platform, open-source make system
ii coreutils 9.4-3ubuntu6 amd64 GNU core utilities ii cmake-data 3.28.3-1build7 all CMake data files (modules, templates and documentation)
ii cpio 2.15+dfsg-1ubuntu2 amd64 GNU cpio -- a program to manage archives of files ii coreutils 9.4-3ubuntu6.1 amd64 GNU core utilities
ii cpp 4:13.2.0-7ubuntu1 amd64 GNU C preprocessor (cpp) ii cpio 2.15+dfsg-1ubuntu2 amd64 GNU cpio -- a program to manage archives of files
ii cpp-13 13.3.0-6ubuntu2~24.04 amd64 GNU C preprocessor ii cpp 4:13.2.0-7ubuntu1 amd64 GNU C preprocessor (cpp)
ii cpp-13-x86-64-linux-gnu 13.3.0-6ubuntu2~24.04 amd64 GNU C preprocessor for x86_64-linux-gnu ii cpp-13 13.3.0-6ubuntu2~24.04 amd64 GNU C preprocessor
ii cpp-x86-64-linux-gnu 4:13.2.0-7ubuntu1 amd64 GNU C preprocessor (cpp) for the amd64 architecture ii cpp-13-riscv64-linux-gnu 13.3.0-6ubuntu2~24.04cross1 amd64 GNU C preprocessor for riscv64-linux-gnu
ii curl 8.5.0-2ubuntu10.6 amd64 command line tool for transferring data with URL syntax ii cpp-13-x86-64-linux-gnu 13.3.0-6ubuntu2~24.04 amd64 GNU C preprocessor for x86_64-linux-gnu
ii dash 0.5.12-6ubuntu5 amd64 POSIX-compliant shell ii cpp-riscv64-linux-gnu 4:13.2.0-7ubuntu1 amd64 GNU C preprocessor (cpp) for the riscv64 architecture
ii debconf 1.5.86ubuntu1 all Debian configuration management system ii cpp-x86-64-linux-gnu 4:13.2.0-7ubuntu1 amd64 GNU C preprocessor (cpp) for the amd64 architecture
ii debianutils 5.17build1 amd64 Miscellaneous utilities specific to Debian ii curl 8.5.0-2ubuntu10.6 amd64 command line tool for transferring data with URL syntax
ii diffstat 1.66-1build1 amd64 produces graph of changes introduced by a diff file ii dash 0.5.12-6ubuntu5 amd64 POSIX-compliant shell
ii diffutils 1:3.10-1build1 amd64 File comparison utilities ii debconf 1.5.86ubuntu1 all Debian configuration management system
ii direnv 2.32.1-2ubuntu0.24.04.3 amd64 Utility to set directory specific environment variables ii debianutils 5.17build1 amd64 Miscellaneous utilities specific to Debian
ii dmidecode 3.5-3ubuntu0.1 amd64 SMBIOS/DMI table decoder ii diffstat 1.66-1build1 amd64 produces graph of changes introduced by a diff file
ii dpkg 1.22.6ubuntu6.1 amd64 Debian package management system ii diffutils 1:3.10-1build1 amd64 File comparison utilities
ii e2fsprogs 1.47.0-2.4~exp1ubuntu4.1 amd64 ext2/ext3/ext4 file system utilities ii direnv 2.32.1-2ubuntu0.24.04.3 amd64 Utility to set directory specific environment variables
ii elfutils 0.190-1.1ubuntu0.1 amd64 collection of utilities to handle ELF objects ii dmidecode 3.5-3ubuntu0.1 amd64 SMBIOS/DMI table decoder
ii execstack 0.0.20131005-1.1ubuntu1 amd64 ELF GNU_STACK program header editing utility ii dpkg 1.22.6ubuntu6.5 amd64 Debian package management system
ii eza 0.18.2-1 amd64 Modern replacement for ls ii e2fsprogs 1.47.0-2.4~exp1ubuntu4.1 amd64 ext2/ext3/ext4 file system utilities
ii fd-find 9.0.0-1 amd64 Simple, fast and user-friendly alternative to find ii elfutils 0.190-1.1ubuntu0.1 amd64 collection of utilities to handle ELF objects
ii file 1:5.45-3build1 amd64 Recognize the type of data in a file using "magic" numbers ii execstack 0.0.20131005-1.1ubuntu1 amd64 ELF GNU_STACK program header editing utility
ii findutils 4.9.0-5build1 amd64 utilities for finding files--find, xargs ii eza 0.18.2-1 amd64 Modern replacement for ls
ii fish 3.7.0-1 amd64 friendly interactive shell ii fd-find 9.0.0-1 amd64 Simple, fast and user-friendly alternative to find
ii fish-common 3.7.0-1 all friendly interactive shell (architecture-independent files) ii file 1:5.45-3build1 amd64 Recognize the type of data in a file using "magic" numbers
ii fzf 0.44.1-1ubuntu0.3 amd64 general-purpose command-line fuzzy finder ii findutils 4.9.0-5build1 amd64 utilities for finding files--find, xargs
ii g++ 4:13.2.0-7ubuntu1 amd64 GNU C++ compiler ii fish 3.7.0-1 amd64 friendly interactive shell
ii g++-13 13.3.0-6ubuntu2~24.04 amd64 GNU C++ compiler ii fish-common 3.7.0-1 all friendly interactive shell (architecture-independent files)
ii g++-13-multilib 13.3.0-6ubuntu2~24.04 amd64 GNU C++ compiler (multilib support) ii fzf 0.44.1-1ubuntu0.3 amd64 general-purpose command-line fuzzy finder
ii g++-13-x86-64-linux-gnu 13.3.0-6ubuntu2~24.04 amd64 GNU C++ compiler for x86_64-linux-gnu architecture ii g++ 4:13.2.0-7ubuntu1 amd64 GNU C++ compiler
ii g++-multilib 4:13.2.0-7ubuntu1 amd64 GNU C++ compiler (multilib files) ii g++-13 13.3.0-6ubuntu2~24.04 amd64 GNU C++ compiler
ii g++-x86-64-linux-gnu 4:13.2.0-7ubuntu1 amd64 GNU C++ compiler for the amd64 architecture ii g++-13-multilib 13.3.0-6ubuntu2~24.04 amd64 GNU C++ compiler (multilib support)
ii gawk 1:5.2.1-2build3 amd64 GNU awk, a pattern scanning and processing language ii g++-13-x86-64-linux-gnu 13.3.0-6ubuntu2~24.04 amd64 GNU C++ compiler for x86_64-linux-gnu architecture
ii gcc 4:13.2.0-7ubuntu1 amd64 GNU C compiler ii g++-x86-64-linux-gnu 4:13.2.0-7ubuntu1 amd64 GNU C++ compiler for the amd64 architecture
ii gcc-13 13.3.0-6ubuntu2~24.04 amd64 GNU C compiler ii gawk 1:5.2.1-2build3 amd64 GNU awk, a pattern scanning and processing language
ii gcc-13-base:amd64 13.3.0-6ubuntu2~24.04 amd64 GCC, the GNU Compiler Collection (base package) ii gcc 4:13.2.0-7ubuntu1 amd64 GNU C compiler
ii gcc-13-multilib 13.3.0-6ubuntu2~24.04 amd64 GNU C compiler (multilib support) ii gcc-13 13.3.0-6ubuntu2~24.04 amd64 GNU C compiler
ii gcc-13-x86-64-linux-gnu 13.3.0-6ubuntu2~24.04 amd64 GNU C compiler for the x86_64-linux-gnu architecture ii gcc-13-base:amd64 13.3.0-6ubuntu2~24.04 amd64 GCC, the GNU Compiler Collection (base package)
ii gcc-14-base:amd64 14.2.0-4ubuntu2~24.04 amd64 GCC, the GNU Compiler Collection (base package) ii gcc-13-cross-base 13.3.0-6ubuntu2~24.04cross1 all GCC, the GNU Compiler Collection (library base package)
ii gcc-14-base:i386 14.2.0-4ubuntu2~24.04 i386 GCC, the GNU Compiler Collection (base package) ii gcc-13-multilib 13.3.0-6ubuntu2~24.04 amd64 GNU C compiler (multilib support)
ii gcc-multilib 4:13.2.0-7ubuntu1 amd64 GNU C compiler (multilib files) ii gcc-13-riscv64-linux-gnu 13.3.0-6ubuntu2~24.04cross1 amd64 GNU C compiler for the riscv64-linux-gnu architecture
ii gcc-x86-64-linux-gnu 4:13.2.0-7ubuntu1 amd64 GNU C compiler for the amd64 architecture ii gcc-13-riscv64-linux-gnu-base:amd64 13.3.0-6ubuntu2~24.04cross1 amd64 GCC, the GNU Compiler Collection (base package)
ii gdb 15.0.50.20240403-0ubuntu1 amd64 GNU Debugger ii gcc-13-x86-64-linux-gnu 13.3.0-6ubuntu2~24.04 amd64 GNU C compiler for the x86_64-linux-gnu architecture
ii gh 2.45.0-1ubuntu0.3 amd64 GitHub CLI, GitHubs official command line tool ii gcc-14-base:amd64 14.2.0-4ubuntu2~24.04 amd64 GCC, the GNU Compiler Collection (base package)
ii git 1:2.43.0-1ubuntu7.3 amd64 fast, scalable, distributed revision control system ii gcc-14-base:i386 14.2.0-4ubuntu2~24.04 i386 GCC, the GNU Compiler Collection (base package)
ii git-man 1:2.43.0-1ubuntu7.3 all fast, scalable, distributed revision control system (manual pages) ii gcc-14-cross-base 14.2.0-4ubuntu2~24.04cross1 all GCC, the GNU Compiler Collection (library base package)
ii gojq 0.12.13-1ubuntu0.24.04.3 amd64 pure Go implementation of jq (program) ii gcc-riscv64-linux-gnu 4:13.2.0-7ubuntu1 amd64 GNU C compiler for the riscv64 architecture
ii gpgv 2.4.4-2ubuntu17.3 amd64 GNU privacy guard - signature verification tool ii gcc-x86-64-linux-gnu 4:13.2.0-7ubuntu1 amd64 GNU C compiler for the amd64 architecture
ii grep 3.11-4build1 amd64 GNU grep, egrep and fgrep ii gdb 15.0.50.20240403-0ubuntu1 amd64 GNU Debugger
ii groff-base 1.23.0-3build2 amd64 GNU troff text-formatting system (base system components) ii gh 2.45.0-1ubuntu0.3 amd64 GitHub CLI, GitHubs official command line tool
ii gzip 1.12-1ubuntu3.1 amd64 GNU compression utilities ii git 1:2.43.0-1ubuntu7.3 amd64 fast, scalable, distributed revision control system
ii hostname 3.23+nmu2ubuntu2 amd64 utility to set/show the host name or domain name ii git-man 1:2.43.0-1ubuntu7.3 all fast, scalable, distributed revision control system (manual pages)
ii ht 2.1.0+repack1-5 amd64 Viewer/editor/analyser (mostly) for executables ii gojq 0.12.13-1ubuntu0.24.04.3 amd64 pure Go implementation of jq (program)
ii htop 3.3.0-4build1 amd64 interactive processes viewer ii gpgv 2.4.4-2ubuntu17.3 amd64 GNU privacy guard - signature verification tool
ii hyperfine 1.18.0-2build1 amd64 Command-line benchmarking tool ii grep 3.11-4build1 amd64 GNU grep, egrep and fgrep
ii init-system-helpers 1.66ubuntu1 all helper tools for all init systems ii groff-base 1.23.0-3build2 amd64 GNU troff text-formatting system (base system components)
ii jq 1.7.1-3ubuntu0.24.04.1 amd64 lightweight and flexible command-line JSON processor ii gzip 1.12-1ubuntu3.1 amd64 GNU compression utilities
ii just 1.21.0-1 amd64 Save and run project-specific commands ii hostname 3.23+nmu2ubuntu2 amd64 utility to set/show the host name or domain name
ii ksh 20240113 all transitional package ii ht 2.1.0+repack1-5 amd64 Viewer/editor/analyser (mostly) for executables
ii ksh93u+m 1.0.8-1 amd64 AT&T KornShell ii htop 3.3.0-4build1 amd64 interactive processes viewer
ii less 590-2ubuntu2.1 amd64 pager program similar to more ii hyperfine 1.18.0-2build1 amd64 Command-line benchmarking tool
ii lftp 4.9.2-2ubuntu1 amd64 Sophisticated command-line FTP/HTTP/BitTorrent client programs ii init-system-helpers 1.66ubuntu1 all helper tools for all init systems
ii lib32asan8 14.2.0-4ubuntu2~24.04 amd64 AddressSanitizer -- a fast memory error detector (32bit) ii jq 1.7.1-3ubuntu0.24.04.1 amd64 lightweight and flexible command-line JSON processor
ii lib32atomic1 14.2.0-4ubuntu2~24.04 amd64 support library providing __atomic built-in functions (32bit) ii just 1.21.0-1 amd64 Save and run project-specific commands
ii lib32gcc-13-dev 13.3.0-6ubuntu2~24.04 amd64 GCC support library (32 bit development files) ii ksh 20240113 all transitional package
ii lib32gcc-s1 14.2.0-4ubuntu2~24.04 amd64 GCC support library (32 bit Version) ii ksh93u+m 1.0.8-1 amd64 AT&T KornShell
ii lib32gomp1 14.2.0-4ubuntu2~24.04 amd64 GCC OpenMP (GOMP) support library (32bit) ii less 590-2ubuntu2.1 amd64 pager program similar to more
ii lib32itm1 14.2.0-4ubuntu2~24.04 amd64 GNU Transactional Memory Library (32bit) ii lftp 4.9.2-2ubuntu1.1 amd64 Sophisticated command-line FTP/HTTP/BitTorrent client programs
ii lib32quadmath0 14.2.0-4ubuntu2~24.04 amd64 GCC Quad-Precision Math Library (32bit) ii lib32asan8 14.2.0-4ubuntu2~24.04 amd64 AddressSanitizer -- a fast memory error detector (32bit)
ii lib32stdc++-13-dev 13.3.0-6ubuntu2~24.04 amd64 GNU Standard C++ Library v3 (development files) ii lib32atomic1 14.2.0-4ubuntu2~24.04 amd64 support library providing __atomic built-in functions (32bit)
ii lib32stdc++6 14.2.0-4ubuntu2~24.04 amd64 GNU Standard C++ Library v3 (32 bit Version) ii lib32gcc-13-dev 13.3.0-6ubuntu2~24.04 amd64 GCC support library (32 bit development files)
ii lib32ubsan1 14.2.0-4ubuntu2~24.04 amd64 UBSan -- undefined behaviour sanitizer (32bit) ii lib32gcc-s1 14.2.0-4ubuntu2~24.04 amd64 GCC support library (32 bit Version)
ii libacl1:amd64 2.3.2-1build1.1 amd64 access control list - shared library ii lib32gomp1 14.2.0-4ubuntu2~24.04 amd64 GCC OpenMP (GOMP) support library (32bit)
ii libapparmor1:amd64 4.0.1really4.0.1-0ubuntu0.24.04.4 amd64 changehat AppArmor library ii lib32itm1 14.2.0-4ubuntu2~24.04 amd64 GNU Transactional Memory Library (32bit)
ii libapt-pkg6.0t64:amd64 2.8.3 amd64 package management runtime library ii lib32quadmath0 14.2.0-4ubuntu2~24.04 amd64 GCC Quad-Precision Math Library (32bit)
ii libarchive13t64:amd64 3.7.2-2ubuntu0.5 amd64 Multi-format archive and compression library (shared library) ii lib32stdc++-13-dev 13.3.0-6ubuntu2~24.04 amd64 GNU Standard C++ Library v3 (development files)
ii libaria2-0:amd64 1.37.0+debian-1build3 amd64 C++ library interface to aria2 ii lib32stdc++6 14.2.0-4ubuntu2~24.04 amd64 GNU Standard C++ Library v3 (32 bit Version)
ii libasan8:amd64 14.2.0-4ubuntu2~24.04 amd64 AddressSanitizer -- a fast memory error detector ii lib32ubsan1 14.2.0-4ubuntu2~24.04 amd64 UBSan -- undefined behaviour sanitizer (32bit)
ii libasm1t64:amd64 0.190-1.1ubuntu0.1 amd64 library with a programmable assembler interface ii libacl1:amd64 2.3.2-1build1.1 amd64 access control list - shared library
ii libassuan0:amd64 2.5.6-1build1 amd64 IPC library for the GnuPG components ii libapparmor1:amd64 4.0.1really4.0.1-0ubuntu0.24.04.4 amd64 changehat AppArmor library
ii libatomic1:amd64 14.2.0-4ubuntu2~24.04 amd64 support library providing __atomic built-in functions ii libapt-pkg6.0t64:amd64 2.8.3 amd64 package management runtime library
ii libattr1:amd64 1:2.5.2-1build1.1 amd64 extended attribute handling - shared library ii libarchive13t64:amd64 3.7.2-2ubuntu0.5 amd64 Multi-format archive and compression library (shared library)
ii libaudit-common 1:3.1.2-2.1build1.1 all Dynamic library for security auditing - common files ii libaria2-0:amd64 1.37.0+debian-1build3 amd64 C++ library interface to aria2
ii libaudit1:amd64 1:3.1.2-2.1build1.1 amd64 Dynamic library for security auditing ii libasan8-riscv64-cross 14.2.0-4ubuntu2~24.04cross1 all AddressSanitizer -- a fast memory error detector
ii libbabeltrace1:amd64 1.5.11-3build3 amd64 Babeltrace conversion libraries ii libasan8:amd64 14.2.0-4ubuntu2~24.04 amd64 AddressSanitizer -- a fast memory error detector
ii libbinutils:amd64 2.42-4ubuntu2.5 amd64 GNU binary utilities (private shared library) ii libasm1t64:amd64 0.190-1.1ubuntu0.1 amd64 library with a programmable assembler interface
ii libblkid1:amd64 2.39.3-9ubuntu6.3 amd64 block device ID library ii libassuan0:amd64 2.5.6-1build1 amd64 IPC library for the GnuPG components
ii libbrotli1:amd64 1.1.0-2build2 amd64 library implementing brotli encoder and decoder (shared libraries) ii libatomic1-riscv64-cross 14.2.0-4ubuntu2~24.04cross1 all support library providing __atomic built-in functions
ii libbsd0:amd64 0.12.1-1build1.1 amd64 utility functions from BSD systems - shared library ii libatomic1:amd64 14.2.0-4ubuntu2~24.04 amd64 support library providing __atomic built-in functions
ii libbz2-1.0:amd64 1.0.8-5.1build0.1 amd64 high-quality block-sorting file compressor library - runtime ii libattr1:amd64 1:2.5.2-1build1.1 amd64 extended attribute handling - shared library
ii libbzip3-0:amd64 1.4.0-1 amd64 better, faster and stronger spiritual successor to bzip2 - runtime ii libaudit-common 1:3.1.2-2.1build1.1 all Dynamic library for security auditing - common files
ii libc-bin 2.39-0ubuntu8.5 amd64 GNU C Library: Binaries ii libaudit1:amd64 1:3.1.2-2.1build1.1 amd64 Dynamic library for security auditing
ii libc-dev-bin 2.39-0ubuntu8.5 amd64 GNU C Library: Development binaries ii libbabeltrace1:amd64 1.5.11-3build3 amd64 Babeltrace conversion libraries
ii libc6-dbg:amd64 2.39-0ubuntu8.5 amd64 GNU C Library: detached debugging symbols ii libbinutils:amd64 2.42-4ubuntu2.6 amd64 GNU binary utilities (private shared library)
ii libc6-dev-i386 2.39-0ubuntu8.5 amd64 GNU C Library: 32-bit development libraries for AMD64 ii libblkid1:amd64 2.39.3-9ubuntu6.3 amd64 block device ID library
ii libc6-dev-x32 2.39-0ubuntu8.5 amd64 GNU C Library: X32 ABI Development Libraries for AMD64 ii libbrotli1:amd64 1.1.0-2build2 amd64 library implementing brotli encoder and decoder (shared libraries)
ii libc6-dev:amd64 2.39-0ubuntu8.5 amd64 GNU C Library: Development Libraries and Header Files ii libbsd0:amd64 0.12.1-1build1.1 amd64 utility functions from BSD systems - shared library
ii libc6-i386 2.39-0ubuntu8.5 amd64 GNU C Library: 32-bit shared libraries for AMD64 ii libbz2-1.0:amd64 1.0.8-5.1build0.1 amd64 high-quality block-sorting file compressor library - runtime
ii libc6-x32 2.39-0ubuntu8.5 amd64 GNU C Library: X32 ABI Shared libraries for AMD64 ii libbzip3-0:amd64 1.4.0-1 amd64 better, faster and stronger spiritual successor to bzip2 - runtime
ii libc6:amd64 2.39-0ubuntu8.5 amd64 GNU C Library: Shared libraries ii libc-bin 2.39-0ubuntu8.6 amd64 GNU C Library: Binaries
ii libc6:i386 2.39-0ubuntu8.5 i386 GNU C Library: Shared libraries ii libc-dev-bin 2.39-0ubuntu8.6 amd64 GNU C Library: Development binaries
ii libcap-ng0:amd64 0.8.4-2build2 amd64 alternate POSIX capabilities library ii libc6-dbg:amd64 2.39-0ubuntu8.6 amd64 GNU C Library: detached debugging symbols
ii libcap2:amd64 1:2.66-5ubuntu2.2 amd64 POSIX 1003.1e capabilities (library) ii libc6-dev-i386 2.39-0ubuntu8.6 amd64 GNU C Library: 32-bit development libraries for AMD64
ii libcares2:amd64 1.27.0-1.0ubuntu1 amd64 asynchronous name resolver ii libc6-dev-riscv64-cross 2.39-0ubuntu8cross1 all GNU C Library: Development Libraries and Header Files (for cross-compiling)
ii libcc1-0:amd64 14.2.0-4ubuntu2~24.04 amd64 GCC cc1 plugin for GDB ii libc6-dev-x32 2.39-0ubuntu8.6 amd64 GNU C Library: X32 ABI Development Libraries for AMD64
ii libcom-err2:amd64 1.47.0-2.4~exp1ubuntu4.1 amd64 common error description library ii libc6-dev:amd64 2.39-0ubuntu8.6 amd64 GNU C Library: Development Libraries and Header Files
ii libcrypt-dev:amd64 1:4.4.36-4build1 amd64 libcrypt development files ii libc6-i386 2.39-0ubuntu8.6 amd64 GNU C Library: 32-bit shared libraries for AMD64
ii libcrypt1:amd64 1:4.4.36-4build1 amd64 libcrypt shared library ii libc6-riscv64-cross 2.39-0ubuntu8cross1 all GNU C Library: Shared libraries (for cross-compiling)
ii libctf-nobfd0:amd64 2.42-4ubuntu2.5 amd64 Compact C Type Format library (runtime, no BFD dependency) ii libc6-x32 2.39-0ubuntu8.6 amd64 GNU C Library: X32 ABI Shared libraries for AMD64
ii libctf0:amd64 2.42-4ubuntu2.5 amd64 Compact C Type Format library (runtime, BFD dependency) ii libc6:amd64 2.39-0ubuntu8.6 amd64 GNU C Library: Shared libraries
ii libcurl3t64-gnutls:amd64 8.5.0-2ubuntu10.6 amd64 easy-to-use client-side URL transfer library (GnuTLS flavour) ii libc6:i386 2.39-0ubuntu8.6 i386 GNU C Library: Shared libraries
ii libcurl4t64:amd64 8.5.0-2ubuntu10.6 amd64 easy-to-use client-side URL transfer library (OpenSSL flavour) ii libcap-ng0:amd64 0.8.4-2build2 amd64 alternate POSIX capabilities library
ii libdb5.3t64:amd64 5.3.28+dfsg2-7 amd64 Berkeley v5.3 Database Libraries [runtime] ii libcap2:amd64 1:2.66-5ubuntu2.2 amd64 POSIX 1003.1e capabilities (library)
ii libdebconfclient0:amd64 0.271ubuntu3 amd64 Debian Configuration Management System (C-implementation library) ii libcares2:amd64 1.27.0-1.0ubuntu1 amd64 asynchronous name resolver
ii libdebuginfod-common 0.190-1.1ubuntu0.1 all configuration to enable the Debian debug info server ii libcc1-0:amd64 14.2.0-4ubuntu2~24.04 amd64 GCC cc1 plugin for GDB
ii libdebuginfod1t64:amd64 0.190-1.1ubuntu0.1 amd64 library to interact with debuginfod (development files) ii libcom-err2:amd64 1.47.0-2.4~exp1ubuntu4.1 amd64 common error description library
ii libdw1t64:amd64 0.190-1.1ubuntu0.1 amd64 library that provides access to the DWARF debug information ii libcrypt-dev:amd64 1:4.4.36-4build1 amd64 libcrypt development files
ii libelf1t64:amd64 0.190-1.1ubuntu0.1 amd64 library to read and write ELF files ii libcrypt1:amd64 1:4.4.36-4build1 amd64 libcrypt shared library
ii liberror-perl 0.17029-2 all Perl module for error/exception handling in an OO-ish way ii libctf-nobfd0:amd64 2.42-4ubuntu2.6 amd64 Compact C Type Format library (runtime, no BFD dependency)
ii libexpat1:amd64 2.6.1-2ubuntu0.3 amd64 XML parsing C library - runtime library ii libctf0:amd64 2.42-4ubuntu2.6 amd64 Compact C Type Format library (runtime, BFD dependency)
ii libext2fs2t64:amd64 1.47.0-2.4~exp1ubuntu4.1 amd64 ext2/ext3/ext4 file system libraries ii libcurl3t64-gnutls:amd64 8.5.0-2ubuntu10.6 amd64 easy-to-use client-side URL transfer library (GnuTLS flavour)
ii libffi8:amd64 3.4.6-1build1 amd64 Foreign Function Interface library runtime ii libcurl4t64:amd64 8.5.0-2ubuntu10.6 amd64 easy-to-use client-side URL transfer library (OpenSSL flavour)
ii libgcc-13-dev:amd64 13.3.0-6ubuntu2~24.04 amd64 GCC support library (development files) ii libdb5.3t64:amd64 5.3.28+dfsg2-7 amd64 Berkeley v5.3 Database Libraries [runtime]
ii libgcc-s1:amd64 14.2.0-4ubuntu2~24.04 amd64 GCC support library ii libdebconfclient0:amd64 0.271ubuntu3 amd64 Debian Configuration Management System (C-implementation library)
ii libgcc-s1:i386 14.2.0-4ubuntu2~24.04 i386 GCC support library ii libdebuginfod-common 0.190-1.1ubuntu0.1 all configuration to enable the Debian debug info server
ii libgcrypt20:amd64 1.10.3-2build1 amd64 LGPL Crypto library - runtime library ii libdebuginfod1t64:amd64 0.190-1.1ubuntu0.1 amd64 library to interact with debuginfod (development files)
ii libgdbm-compat4t64:amd64 1.23-5.1build1 amd64 GNU dbm database routines (legacy support runtime version) ii libdw1t64:amd64 0.190-1.1ubuntu0.1 amd64 library that provides access to the DWARF debug information
ii libgdbm6t64:amd64 1.23-5.1build1 amd64 GNU dbm database routines (runtime version) ii libelf1t64:amd64 0.190-1.1ubuntu0.1 amd64 library to read and write ELF files
ii libgit2-1.7:amd64 1.7.2+ds-1ubuntu3 amd64 low-level Git library ii liberror-perl 0.17029-2 all Perl module for error/exception handling in an OO-ish way
ii libglib2.0-0t64:amd64 2.80.0-6ubuntu3.4 amd64 GLib library of C routines ii libexpat1:amd64 2.6.1-2ubuntu0.3 amd64 XML parsing C library - runtime library
ii libgmp10:amd64 2:6.3.0+dfsg-2ubuntu6.1 amd64 Multiprecision arithmetic library ii libext2fs2t64:amd64 1.47.0-2.4~exp1ubuntu4.1 amd64 ext2/ext3/ext4 file system libraries
ii libgnutls30t64:amd64 3.8.3-1.1ubuntu3.4 amd64 GNU TLS library - main runtime library ii libffi8:amd64 3.4.6-1build1 amd64 Foreign Function Interface library runtime
ii libgomp1:amd64 14.2.0-4ubuntu2~24.04 amd64 GCC OpenMP (GOMP) support library ii libgcc-13-dev-riscv64-cross 13.3.0-6ubuntu2~24.04cross1 all GCC support library (development files)
ii libgpg-error0:amd64 1.47-3build2.1 amd64 GnuPG development runtime library ii libgcc-13-dev:amd64 13.3.0-6ubuntu2~24.04 amd64 GCC support library (development files)
ii libgprofng0:amd64 2.42-4ubuntu2.5 amd64 GNU Next Generation profiler (runtime library) ii libgcc-s1-riscv64-cross 14.2.0-4ubuntu2~24.04cross1 all GCC support library (riscv64)
ii libgssapi-krb5-2:amd64 1.20.1-6ubuntu2.6 amd64 MIT Kerberos runtime libraries - krb5 GSS-API Mechanism ii libgcc-s1:amd64 14.2.0-4ubuntu2~24.04 amd64 GCC support library
ii libhiredis1.1.0:amd64 1.2.0-6ubuntu3 amd64 minimalistic C client library for Redis ii libgcc-s1:i386 14.2.0-4ubuntu2~24.04 i386 GCC support library
ii libhogweed6t64:amd64 3.9.1-2.2build1.1 amd64 low level cryptographic library (public-key cryptos) ii libgcrypt20:amd64 1.10.3-2build1 amd64 LGPL Crypto library - runtime library
ii libhttp-parser2.9:amd64 2.9.4-6build1 amd64 parser for HTTP messages written in C ii libgdbm-compat4t64:amd64 1.23-5.1build1 amd64 GNU dbm database routines (legacy support runtime version)
ii libhwasan0:amd64 14.2.0-4ubuntu2~24.04 amd64 AddressSanitizer -- a fast memory error detector ii libgdbm6t64:amd64 1.23-5.1build1 amd64 GNU dbm database routines (runtime version)
ii libicu74:amd64 74.2-1ubuntu3.1 amd64 International Components for Unicode ii libgit2-1.7:amd64 1.7.2+ds-1ubuntu3 amd64 low-level Git library
ii libidn2-0:amd64 2.3.7-2build1.1 amd64 Internationalized domain names (IDNA2008/TR46) library ii libglib2.0-0t64:amd64 2.80.0-6ubuntu3.4 amd64 GLib library of C routines
ii libio-pty-perl 1:1.20-1build2 amd64 Perl module for pseudo tty IO ii libgmp10:amd64 2:6.3.0+dfsg-2ubuntu6.1 amd64 Multiprecision arithmetic library
ii libipc-run-perl 20231003.0-1 all Perl module for running processes ii libgnutls30t64:amd64 3.8.3-1.1ubuntu3.4 amd64 GNU TLS library - main runtime library
ii libipt2 2.0.6-1build1 amd64 Intel Processor Trace Decoder Library ii libgomp1-riscv64-cross 14.2.0-4ubuntu2~24.04cross1 all GCC OpenMP (GOMP) support library
ii libisl23:amd64 0.26-3build1.1 amd64 manipulating sets and relations of integer points bounded by linear constraints ii libgomp1:amd64 14.2.0-4ubuntu2~24.04 amd64 GCC OpenMP (GOMP) support library
ii libitm1:amd64 14.2.0-4ubuntu2~24.04 amd64 GNU Transactional Memory Library ii libgpg-error0:amd64 1.47-3build2.1 amd64 GnuPG development runtime library
ii libjansson4:amd64 2.14-2build2 amd64 C library for encoding, decoding and manipulating JSON data ii libgprofng0:amd64 2.42-4ubuntu2.6 amd64 GNU Next Generation profiler (runtime library)
ii libjq1:amd64 1.7.1-3ubuntu0.24.04.1 amd64 lightweight and flexible command-line JSON processor - shared library ii libgssapi-krb5-2:amd64 1.20.1-6ubuntu2.6 amd64 MIT Kerberos runtime libraries - krb5 GSS-API Mechanism
ii libjsoncpp25:amd64 1.9.5-6build1 amd64 library for reading and writing JSON for C++ ii libhiredis1.1.0:amd64 1.2.0-6ubuntu3 amd64 minimalistic C client library for Redis
ii libk5crypto3:amd64 1.20.1-6ubuntu2.6 amd64 MIT Kerberos runtime libraries - Crypto Library ii libhogweed6t64:amd64 3.9.1-2.2build1.1 amd64 low level cryptographic library (public-key cryptos)
ii libkeyutils1:amd64 1.6.3-3build1 amd64 Linux Key Management Utilities (library) ii libhttp-parser2.9:amd64 2.9.4-6build1 amd64 parser for HTTP messages written in C
ii libkrb5-3:amd64 1.20.1-6ubuntu2.6 amd64 MIT Kerberos runtime libraries ii libhwasan0:amd64 14.2.0-4ubuntu2~24.04 amd64 AddressSanitizer -- a fast memory error detector
ii libkrb5support0:amd64 1.20.1-6ubuntu2.6 amd64 MIT Kerberos runtime libraries - Support library ii libicu74:amd64 74.2-1ubuntu3.1 amd64 International Components for Unicode
ii libldap2:amd64 2.6.7+dfsg-1~exp1ubuntu8.2 amd64 OpenLDAP libraries ii libidn2-0:amd64 2.3.7-2build1.1 amd64 Internationalized domain names (IDNA2008/TR46) library
ii liblsan0:amd64 14.2.0-4ubuntu2~24.04 amd64 LeakSanitizer -- a memory leak detector (runtime) ii libio-pty-perl 1:1.20-1build2 amd64 Perl module for pseudo tty IO
ii libluajit-5.1-2:amd64 2.1.0+git20231223.c525bcb+dfsg-1 amd64 Just in time compiler for Lua - library version ii libipc-run-perl 20231003.0-1 all Perl module for running processes
ii libluajit-5.1-common 2.1.0+git20231223.c525bcb+dfsg-1 all Just in time compiler for Lua - common files ii libipt2 2.0.6-1build1 amd64 Intel Processor Trace Decoder Library
ii liblz4-1:amd64 1.9.4-1build1.1 amd64 Fast LZ compression algorithm library - runtime ii libisl23:amd64 0.26-3build1.1 amd64 manipulating sets and relations of integer points bounded by linear constraints
ii liblzma5:amd64 5.6.1+really5.4.5-1ubuntu0.2 amd64 XZ-format compression library ii libitm1-riscv64-cross 14.2.0-4ubuntu2~24.04cross1 all GNU Transactional Memory Library
ii liblzo2-2:amd64 2.10-2build4 amd64 data compression library ii libitm1:amd64 14.2.0-4ubuntu2~24.04 amd64 GNU Transactional Memory Library
ii libmagic-mgc 1:5.45-3build1 amd64 File type determination library using "magic" numbers (compiled magic file) ii libjansson4:amd64 2.14-2build2 amd64 C library for encoding, decoding and manipulating JSON data
ii libmagic1t64:amd64 1:5.45-3build1 amd64 Recognize the type of data in a file using "magic" numbers - library ii libjq1:amd64 1.7.1-3ubuntu0.24.04.1 amd64 lightweight and flexible command-line JSON processor - shared library
ii libmd0:amd64 1.1.0-2build1.1 amd64 message digest functions from BSD systems - shared library ii libjsoncpp25:amd64 1.9.5-6build1 amd64 library for reading and writing JSON for C++
ii libmount1:amd64 2.39.3-9ubuntu6.3 amd64 device mounting library ii libk5crypto3:amd64 1.20.1-6ubuntu2.6 amd64 MIT Kerberos runtime libraries - Crypto Library
ii libmpc3:amd64 1.3.1-1build1.1 amd64 multiple precision complex floating-point library ii libkeyutils1:amd64 1.6.3-3build1 amd64 Linux Key Management Utilities (library)
ii libmpfr6:amd64 4.2.1-1build1.1 amd64 multiple precision floating-point computation ii libkrb5-3:amd64 1.20.1-6ubuntu2.6 amd64 MIT Kerberos runtime libraries
ii libmsgpackc2:amd64 4.0.0-3build1 amd64 binary-based efficient object serialization library ii libkrb5support0:amd64 1.20.1-6ubuntu2.6 amd64 MIT Kerberos runtime libraries - Support library
ii libmspack0t64:amd64 0.11-1.1build1 amd64 library for Microsoft compression formats (shared library) ii libldap2:amd64 2.6.7+dfsg-1~exp1ubuntu8.2 amd64 OpenLDAP libraries
ii libncurses6:amd64 6.4+20240113-1ubuntu2 amd64 shared libraries for terminal handling ii liblsan0:amd64 14.2.0-4ubuntu2~24.04 amd64 LeakSanitizer -- a memory leak detector (runtime)
ii libncursesw6:amd64 6.4+20240113-1ubuntu2 amd64 shared libraries for terminal handling (wide character support) ii libluajit-5.1-2:amd64 2.1.0+git20231223.c525bcb+dfsg-1 amd64 Just in time compiler for Lua - library version
ii libnettle8t64:amd64 3.9.1-2.2build1.1 amd64 low level cryptographic library (symmetric and one-way cryptos) ii libluajit-5.1-common 2.1.0+git20231223.c525bcb+dfsg-1 all Just in time compiler for Lua - common files
ii libnghttp2-14:amd64 1.59.0-1ubuntu0.2 amd64 library implementing HTTP/2 protocol (shared library) ii liblz4-1:amd64 1.9.4-1build1.1 amd64 Fast LZ compression algorithm library - runtime
ii libnl-3-200:amd64 3.7.0-0.3build1.1 amd64 library for dealing with netlink sockets ii liblzma5:amd64 5.6.1+really5.4.5-1ubuntu0.2 amd64 XZ-format compression library
ii libnl-genl-3-200:amd64 3.7.0-0.3build1.1 amd64 library for dealing with netlink sockets - generic netlink ii liblzo2-2:amd64 2.10-2build4 amd64 data compression library
ii libnpth0t64:amd64 1.6-3.1build1 amd64 replacement for GNU Pth using system threads ii libmagic-mgc 1:5.45-3build1 amd64 File type determination library using "magic" numbers (compiled magic file)
ii libonig5:amd64 6.9.9-1build1 amd64 regular expressions library ii libmagic1t64:amd64 1:5.45-3build1 amd64 Recognize the type of data in a file using "magic" numbers - library
ii libp11-kit0:amd64 0.25.3-4ubuntu2.1 amd64 library for loading and coordinating access to PKCS#11 modules - runtime ii libmd0:amd64 1.1.0-2build1.1 amd64 message digest functions from BSD systems - shared library
ii libpam-modules-bin 1.5.3-5ubuntu5.4 amd64 Pluggable Authentication Modules for PAM - helper binaries ii libmount1:amd64 2.39.3-9ubuntu6.3 amd64 device mounting library
ii libpam-modules:amd64 1.5.3-5ubuntu5.4 amd64 Pluggable Authentication Modules for PAM ii libmpc3:amd64 1.3.1-1build1.1 amd64 multiple precision complex floating-point library
ii libpam-runtime 1.5.3-5ubuntu5.4 all Runtime support for the PAM library ii libmpfr6:amd64 4.2.1-1build1.1 amd64 multiple precision floating-point computation
ii libpam0g:amd64 1.5.3-5ubuntu5.4 amd64 Pluggable Authentication Modules library ii libmsgpackc2:amd64 4.0.0-3build1 amd64 binary-based efficient object serialization library
ii libpcre2-32-0:amd64 10.42-4ubuntu2.1 amd64 New Perl Compatible Regular Expression Library - 32 bit runtime files ii libmspack0t64:amd64 0.11-1.1build1 amd64 library for Microsoft compression formats (shared library)
ii libpcre2-8-0:amd64 10.42-4ubuntu2.1 amd64 New Perl Compatible Regular Expression Library- 8 bit runtime files ii libncurses6:amd64 6.4+20240113-1ubuntu2 amd64 shared libraries for terminal handling
ii libperl5.38t64:amd64 5.38.2-3.2ubuntu0.1 amd64 shared Perl library ii libncursesw6:amd64 6.4+20240113-1ubuntu2 amd64 shared libraries for terminal handling (wide character support)
ii libpipeline1:amd64 1.5.7-2 amd64 Unix process pipeline manipulation library ii libnettle8t64:amd64 3.9.1-2.2build1.1 amd64 low level cryptographic library (symmetric and one-way cryptos)
ii libpopt0:amd64 1.19+dfsg-1build1 amd64 lib for parsing cmdline parameters ii libnghttp2-14:amd64 1.59.0-1ubuntu0.2 amd64 library implementing HTTP/2 protocol (shared library)
ii libproc2-0:amd64 2:4.0.4-4ubuntu3.2 amd64 library for accessing process information from /proc ii libnl-3-200:amd64 3.7.0-0.3build1.1 amd64 library for dealing with netlink sockets
ii libpsl5t64:amd64 0.21.2-1.1build1 amd64 Library for Public Suffix List (shared libraries) ii libnl-genl-3-200:amd64 3.7.0-0.3build1.1 amd64 library for dealing with netlink sockets - generic netlink
ii libpython2.7-minimal:amd64 2.7.18-8+deb11u1 amd64 Minimal subset of the Python language (version 2.7) ii libnpth0t64:amd64 1.6-3.1build1 amd64 replacement for GNU Pth using system threads
ii libpython3-stdlib:amd64 3.12.3-0ubuntu2 amd64 interactive high-level object-oriented language (default python3 version) ii libonig5:amd64 6.9.9-1build1 amd64 regular expressions library
ii libpython3.12-minimal:amd64 3.12.3-1ubuntu0.7 amd64 Minimal subset of the Python language (version 3.12) ii libp11-kit0:amd64 0.25.3-4ubuntu2.1 amd64 library for loading and coordinating access to PKCS#11 modules - runtime
ii libpython3.12-stdlib:amd64 3.12.3-1ubuntu0.7 amd64 Interactive high-level object-oriented language (standard library, version 3.12) ii libpam-modules-bin 1.5.3-5ubuntu5.5 amd64 Pluggable Authentication Modules for PAM - helper binaries
ii libpython3.12t64:amd64 3.12.3-1ubuntu0.7 amd64 Shared Python runtime library (version 3.12) ii libpam-modules:amd64 1.5.3-5ubuntu5.5 amd64 Pluggable Authentication Modules for PAM
ii libquadmath0:amd64 14.2.0-4ubuntu2~24.04 amd64 GCC Quad-Precision Math Library ii libpam-runtime 1.5.3-5ubuntu5.5 all Runtime support for the PAM library
ii libreadline8t64:amd64 8.2-4build1 amd64 GNU readline and history libraries, run-time libraries ii libpam0g:amd64 1.5.3-5ubuntu5.5 amd64 Pluggable Authentication Modules library
ii librhash0:amd64 1.4.3-3build1 amd64 shared library for hash functions computing ii libpcre2-32-0:amd64 10.42-4ubuntu2.1 amd64 New Perl Compatible Regular Expression Library - 32 bit runtime files
ii librtmp1:amd64 2.4+20151223.gitfa8646d.1-2build7 amd64 toolkit for RTMP streams (shared library) ii libpcre2-8-0:amd64 10.42-4ubuntu2.1 amd64 New Perl Compatible Regular Expression Library- 8 bit runtime files
ii libsasl2-2:amd64 2.1.28+dfsg1-5ubuntu3.1 amd64 Cyrus SASL - authentication abstraction library ii libperl5.38t64:amd64 5.38.2-3.2ubuntu0.2 amd64 shared Perl library
ii libsasl2-modules-db:amd64 2.1.28+dfsg1-5ubuntu3.1 amd64 Cyrus SASL - pluggable authentication modules (DB) ii libpipeline1:amd64 1.5.7-2 amd64 Unix process pipeline manipulation library
ii libseccomp2:amd64 2.5.5-1ubuntu3.1 amd64 high level interface to Linux seccomp filter ii libpopt0:amd64 1.19+dfsg-1build1 amd64 lib for parsing cmdline parameters
ii libselinux1:amd64 3.5-2ubuntu2.1 amd64 SELinux runtime shared libraries ii libproc2-0:amd64 2:4.0.4-4ubuntu3.2 amd64 library for accessing process information from /proc
ii libsemanage-common 3.5-1build5 all Common files for SELinux policy management libraries ii libpsl5t64:amd64 0.21.2-1.1build1 amd64 Library for Public Suffix List (shared libraries)
ii libsemanage2:amd64 3.5-1build5 amd64 SELinux policy management library ii libpython2.7-minimal:amd64 2.7.18-8+deb11u1 amd64 Minimal subset of the Python language (version 2.7)
ii libsensors-config 1:3.6.0-9build1 all lm-sensors configuration files ii libpython3-stdlib:amd64 3.12.3-0ubuntu2 amd64 interactive high-level object-oriented language (default python3 version)
ii libsensors5:amd64 1:3.6.0-9build1 amd64 library to read temperature/voltage/fan sensors ii libpython3.12-minimal:amd64 3.12.3-1ubuntu0.8 amd64 Minimal subset of the Python language (version 3.12)
ii libsepol2:amd64 3.5-2build1 amd64 SELinux library for manipulating binary security policies ii libpython3.12-stdlib:amd64 3.12.3-1ubuntu0.8 amd64 Interactive high-level object-oriented language (standard library, version 3.12)
ii libsframe1:amd64 2.42-4ubuntu2.5 amd64 Library to handle the SFrame format (runtime library) ii libpython3.12t64:amd64 3.12.3-1ubuntu0.8 amd64 Shared Python runtime library (version 3.12)
ii libsigsegv2:amd64 2.14-1ubuntu2 amd64 Library for handling page faults in a portable way ii libquadmath0:amd64 14.2.0-4ubuntu2~24.04 amd64 GCC Quad-Precision Math Library
ii libsmartcols1:amd64 2.39.3-9ubuntu6.3 amd64 smart column output alignment library ii libreadline8t64:amd64 8.2-4build1 amd64 GNU readline and history libraries, run-time libraries
ii libsource-highlight-common 3.1.9-4.3build1 all architecture-independent files for source highlighting library ii librhash0:amd64 1.4.3-3build1 amd64 shared library for hash functions computing
ii libsource-highlight4t64:amd64 3.1.9-4.3build1 amd64 source highlighting library ii librtmp1:amd64 2.4+20151223.gitfa8646d.1-2build7 amd64 toolkit for RTMP streams (shared library)
ii libsqlite3-0:amd64 3.45.1-1ubuntu2.3 amd64 SQLite 3 shared library ii libsasl2-2:amd64 2.1.28+dfsg1-5ubuntu3.1 amd64 Cyrus SASL - authentication abstraction library
ii libss2:amd64 1.47.0-2.4~exp1ubuntu4.1 amd64 command-line interface parsing library ii libsasl2-modules-db:amd64 2.1.28+dfsg1-5ubuntu3.1 amd64 Cyrus SASL - pluggable authentication modules (DB)
ii libssh-4:amd64 0.10.6-2ubuntu0.1 amd64 tiny C SSH library (OpenSSL flavor) ii libseccomp2:amd64 2.5.5-1ubuntu3.1 amd64 high level interface to Linux seccomp filter
ii libssh2-1t64:amd64 1.11.0-4.1build2 amd64 SSH2 client-side library ii libselinux1:amd64 3.5-2ubuntu2.1 amd64 SELinux runtime shared libraries
ii libssl3t64:amd64 3.0.13-0ubuntu3.5 amd64 Secure Sockets Layer toolkit - shared libraries ii libsemanage-common 3.5-1build5 all Common files for SELinux policy management libraries
ii libstdc++-13-dev:amd64 13.3.0-6ubuntu2~24.04 amd64 GNU Standard C++ Library v3 (development files) ii libsemanage2:amd64 3.5-1build5 amd64 SELinux policy management library
ii libstdc++6:amd64 14.2.0-4ubuntu2~24.04 amd64 GNU Standard C++ Library v3 ii libsensors-config 1:3.6.0-9build1 all lm-sensors configuration files
ii libsystemd0:amd64 255.4-1ubuntu8.10 amd64 systemd utility library ii libsensors5:amd64 1:3.6.0-9build1 amd64 library to read temperature/voltage/fan sensors
ii libtalloc2:amd64 2.4.2-1build2 amd64 hierarchical pool based memory allocator ii libsepol2:amd64 3.5-2build1 amd64 SELinux library for manipulating binary security policies
ii libtasn1-6:amd64 4.19.0-3ubuntu0.24.04.1 amd64 Manage ASN.1 structures (runtime) ii libsframe1:amd64 2.42-4ubuntu2.6 amd64 Library to handle the SFrame format (runtime library)
ii libtermkey1:amd64 0.22-1 amd64 library for processing keyboard input ii libsigsegv2:amd64 2.14-1ubuntu2 amd64 Library for handling page faults in a portable way
ii libtime-duration-perl 1.21-2 all module for rounded or exact English expression of durations ii libsmartcols1:amd64 2.39.3-9ubuntu6.3 amd64 smart column output alignment library
ii libtimedate-perl 2.3300-2 all collection of modules to manipulate date/time information ii libsource-highlight-common 3.1.9-4.3build1 all architecture-independent files for source highlighting library
ii libtinfo6:amd64 6.4+20240113-1ubuntu2 amd64 shared low-level terminfo library for terminal handling ii libsource-highlight4t64:amd64 3.1.9-4.3build1 amd64 source highlighting library
ii libtree-sitter0:amd64 0.20.8-2 amd64 incremental parsing system for programming tools ii libsqlite3-0:amd64 3.45.1-1ubuntu2.5 amd64 SQLite 3 shared library
ii libtsan2:amd64 14.2.0-4ubuntu2~24.04 amd64 ThreadSanitizer -- a Valgrind-based detector of data races (runtime) ii libss2:amd64 1.47.0-2.4~exp1ubuntu4.1 amd64 command-line interface parsing library
ii libubsan1:amd64 14.2.0-4ubuntu2~24.04 amd64 UBSan -- undefined behaviour sanitizer (runtime) ii libssh-4:amd64 0.10.6-2ubuntu0.2 amd64 tiny C SSH library (OpenSSL flavor)
ii libuchardet0:amd64 0.0.8-1build1 amd64 universal charset detection library - shared library ii libssh2-1t64:amd64 1.11.0-4.1build2 amd64 SSH2 client-side library
ii libudev1:amd64 255.4-1ubuntu8.10 amd64 libudev shared library ii libssl3t64:amd64 3.0.13-0ubuntu3.6 amd64 Secure Sockets Layer toolkit - shared libraries
ii libunibilium4:amd64 2.1.0-3 amd64 simple, self-contained terminfo library ii libstdc++-13-dev:amd64 13.3.0-6ubuntu2~24.04 amd64 GNU Standard C++ Library v3 (development files)
ii libunistring5:amd64 1.1-2build1.1 amd64 Unicode string library for C ii libstdc++6-riscv64-cross 14.2.0-4ubuntu2~24.04cross1 all GNU Standard C++ Library v3 (riscv64)
ii libunwind8:amd64 1.6.2-3build1.1 amd64 library to determine the call-chain of a program - runtime ii libstdc++6:amd64 14.2.0-4ubuntu2~24.04 amd64 GNU Standard C++ Library v3
ii liburing2:amd64 2.5-1build1 amd64 Linux kernel io_uring access library - shared library ii libsystemd0:amd64 255.4-1ubuntu8.11 amd64 systemd utility library
ii libutempter0:amd64 1.2.1-3build1 amd64 privileged helper for utmp/wtmp updates (runtime) ii libtalloc2:amd64 2.4.2-1build2 amd64 hierarchical pool based memory allocator
ii libuuid1:amd64 2.39.3-9ubuntu6.3 amd64 Universally Unique ID library ii libtasn1-6:amd64 4.19.0-3ubuntu0.24.04.1 amd64 Manage ASN.1 structures (runtime)
ii libuv1t64:amd64 1.48.0-1.1build1 amd64 asynchronous event notification library - runtime library ii libtermkey1:amd64 0.22-1 amd64 library for processing keyboard input
ii libvterm0:amd64 0.3.3-2build1 amd64 abstract terminal library ii libtime-duration-perl 1.21-2 all module for rounded or exact English expression of durations
ii libwrap0:amd64 7.6.q-33 amd64 Wietse Venema's TCP wrappers library ii libtimedate-perl 2.3300-2 all collection of modules to manipulate date/time information
ii libx11-6:amd64 2:1.8.7-1build1 amd64 X11 client-side library ii libtinfo6:amd64 6.4+20240113-1ubuntu2 amd64 shared low-level terminfo library for terminal handling
ii libx11-data 2:1.8.7-1build1 all X11 client-side library ii libtree-sitter0:amd64 0.20.8-2 amd64 incremental parsing system for programming tools
ii libx32asan8 14.2.0-4ubuntu2~24.04 amd64 AddressSanitizer -- a fast memory error detector (x32) ii libtsan2:amd64 14.2.0-4ubuntu2~24.04 amd64 ThreadSanitizer -- a Valgrind-based detector of data races (runtime)
ii libx32atomic1 14.2.0-4ubuntu2~24.04 amd64 support library providing __atomic built-in functions (x32) ii libubsan1-riscv64-cross 14.2.0-4ubuntu2~24.04cross1 all UBSan -- undefined behaviour sanitizer (runtime)
ii libx32gcc-13-dev 13.3.0-6ubuntu2~24.04 amd64 GCC support library (x32 development files) ii libubsan1:amd64 14.2.0-4ubuntu2~24.04 amd64 UBSan -- undefined behaviour sanitizer (runtime)
ii libx32gcc-s1 14.2.0-4ubuntu2~24.04 amd64 GCC support library (x32) ii libuchardet0:amd64 0.0.8-1build1 amd64 universal charset detection library - shared library
ii libx32gomp1 14.2.0-4ubuntu2~24.04 amd64 GCC OpenMP (GOMP) support library (x32) ii libudev1:amd64 255.4-1ubuntu8.11 amd64 libudev shared library
ii libx32itm1 14.2.0-4ubuntu2~24.04 amd64 GNU Transactional Memory Library (x32) ii libunibilium4:amd64 2.1.0-3 amd64 simple, self-contained terminfo library
ii libx32quadmath0 14.2.0-4ubuntu2~24.04 amd64 GCC Quad-Precision Math Library (x32) ii libunistring5:amd64 1.1-2build1.1 amd64 Unicode string library for C
ii libx32stdc++-13-dev 13.3.0-6ubuntu2~24.04 amd64 GNU Standard C++ Library v3 (development files) ii libunwind8:amd64 1.6.2-3build1.1 amd64 library to determine the call-chain of a program - runtime
ii libx32stdc++6 14.2.0-4ubuntu2~24.04 amd64 GNU Standard C++ Library v3 (x32) ii liburing2:amd64 2.5-1build1 amd64 Linux kernel io_uring access library - shared library
ii libx32ubsan1 14.2.0-4ubuntu2~24.04 amd64 UBSan -- undefined behaviour sanitizer (x32) ii libutempter0:amd64 1.2.1-3build1 amd64 privileged helper for utmp/wtmp updates (runtime)
ii libxau6:amd64 1:1.0.9-1build6 amd64 X11 authorisation library ii libuuid1:amd64 2.39.3-9ubuntu6.3 amd64 Universally Unique ID library
ii libxcb1:amd64 1.15-1ubuntu2 amd64 X C Binding ii libuv1t64:amd64 1.48.0-1.1build1 amd64 asynchronous event notification library - runtime library
ii libxdmcp6:amd64 1:1.1.3-0ubuntu6 amd64 X11 Display Manager Control Protocol library ii libvterm0:amd64 0.3.3-2build1 amd64 abstract terminal library
ii libxml2:amd64 2.9.14+dfsg-1.3ubuntu3.3 amd64 GNOME XML library ii libwrap0:amd64 7.6.q-33 amd64 Wietse Venema's TCP wrappers library
ii libxxhash0:amd64 0.8.2-2build1 amd64 shared library for xxhash ii libx11-6:amd64 2:1.8.7-1build1 amd64 X11 client-side library
ii libyaml-0-2:amd64 0.2.5-1build1 amd64 Fast YAML 1.1 parser and emitter library ii libx11-data 2:1.8.7-1build1 all X11 client-side library
ii libzstd-dev:amd64 1.5.5+dfsg2-2build1.1 amd64 fast lossless compression algorithm -- development files ii libx32asan8 14.2.0-4ubuntu2~24.04 amd64 AddressSanitizer -- a fast memory error detector (x32)
ii libzstd1:amd64 1.5.5+dfsg2-2build1.1 amd64 fast lossless compression algorithm ii libx32atomic1 14.2.0-4ubuntu2~24.04 amd64 support library providing __atomic built-in functions (x32)
ii linux-libc-dev:amd64 6.8.0-64.67 amd64 Linux Kernel Headers for development ii libx32gcc-13-dev 13.3.0-6ubuntu2~24.04 amd64 GCC support library (x32 development files)
ii login 1:4.13+dfsg1-4ubuntu3.2 amd64 system login tools ii libx32gcc-s1 14.2.0-4ubuntu2~24.04 amd64 GCC support library (x32)
ii logsave 1.47.0-2.4~exp1ubuntu4.1 amd64 save the output of a command in a log file ii libx32gomp1 14.2.0-4ubuntu2~24.04 amd64 GCC OpenMP (GOMP) support library (x32)
ii lsb-release 12.0-2 all Linux Standard Base version reporting utility (minimal implementation) ii libx32itm1 14.2.0-4ubuntu2~24.04 amd64 GNU Transactional Memory Library (x32)
ii lsd 1.0.0-2 amd64 ls command with a lot of pretty colors and some other stuff ii libx32quadmath0 14.2.0-4ubuntu2~24.04 amd64 GCC Quad-Precision Math Library (x32)
ii lua-luv:amd64 1.48.0-2-2build1 amd64 libuv bindings for Lua ii libx32stdc++-13-dev 13.3.0-6ubuntu2~24.04 amd64 GNU Standard C++ Library v3 (development files)
ii lz4 1.9.4-1build1.1 amd64 Fast LZ compression algorithm library - tool ii libx32stdc++6 14.2.0-4ubuntu2~24.04 amd64 GNU Standard C++ Library v3 (x32)
ii lzip 1.24.1-1build1 amd64 lossless data compressor based on the LZMA algorithm ii libx32ubsan1 14.2.0-4ubuntu2~24.04 amd64 UBSan -- undefined behaviour sanitizer (x32)
ii lzop 1.04-2build3 amd64 fast compression program ii libxau6:amd64 1:1.0.9-1build6 amd64 X11 authorisation library
ii make 4.3-4.1build2 amd64 utility for directing compilation ii libxcb1:amd64 1.15-1ubuntu2 amd64 X C Binding
ii man-db 2.12.0-4build2 amd64 tools for reading manual pages ii libxdmcp6:amd64 1:1.1.3-0ubuntu6 amd64 X11 Display Manager Control Protocol library
ii mawk 1.3.4.20240123-1build1 amd64 Pattern scanning and text processing language ii libxml2:amd64 2.9.14+dfsg-1.3ubuntu3.6 amd64 GNOME XML library
ii media-types 10.1.0 all List of standard media types and their usual file extension ii libxxhash0:amd64 0.8.2-2build1 amd64 shared library for xxhash
ii minify 2.20.17-1 amd64 CLI implementation of the Go minify library package ii libyaml-0-2:amd64 0.2.5-1build1 amd64 Fast YAML 1.1 parser and emitter library
ii mksh 59c-37 amd64 MirBSD Korn Shell ii libzstd-dev:amd64 1.5.5+dfsg2-2build1.1 amd64 fast lossless compression algorithm -- development files
ii moreutils 0.69-1 amd64 additional Unix utilities ii libzstd1:amd64 1.5.5+dfsg2-2build1.1 amd64 fast lossless compression algorithm
ii mount 2.39.3-9ubuntu6.3 amd64 tools for mounting and manipulating filesystems ii linux-libc-dev-riscv64-cross 6.8.0-25.25cross1 all Linux Kernel Headers for development (for cross-compiling)
ii musl:amd64 1.2.4-2 amd64 standard C library ii linux-libc-dev:amd64 6.8.0-87.88 amd64 Linux Kernel Headers for development
ii ncurses-base 6.4+20240113-1ubuntu2 all basic terminal type definitions ii login 1:4.13+dfsg1-4ubuntu3.2 amd64 system login tools
ii ncurses-bin 6.4+20240113-1ubuntu2 amd64 terminal-related programs and man pages ii logsave 1.47.0-2.4~exp1ubuntu4.1 amd64 save the output of a command in a log file
ii ncurses-term 6.4+20240113-1ubuntu2 all additional terminal type definitions ii lsb-release 12.0-2 all Linux Standard Base version reporting utility (minimal implementation)
ii neovim 0.9.5-6ubuntu2 amd64 heavily refactored vim fork ii lsd 1.0.0-2 amd64 ls command with a lot of pretty colors and some other stuff
ii neovim-runtime 0.9.5-6ubuntu2 all heavily refactored vim fork (runtime files) ii lua-luv:amd64 1.48.0-2-2build1 amd64 libuv bindings for Lua
ii netbase 6.4 all Basic TCP/IP networking system ii lz4 1.9.4-1build1.1 amd64 Fast LZ compression algorithm library - tool
ii ninja-build 1.11.1-2 amd64 small build system closest in spirit to Make ii lzip 1.24.1-1build1 amd64 lossless data compressor based on the LZMA algorithm
ii openssl 3.0.13-0ubuntu3.5 amd64 Secure Sockets Layer toolkit - cryptographic utility ii lzop 1.04-2build3 amd64 fast compression program
ii p7zip 16.02+transitional.1 all transitional package ii make 4.3-4.1build2 amd64 utility for directing compilation
ii parallel 20231122+ds-1 all build and execute command lines from standard input in parallel ii man-db 2.12.0-4build2 amd64 tools for reading manual pages
ii passwd 1:4.13+dfsg1-4ubuntu3.2 amd64 change and administer password and group data ii mawk 1.3.4.20240123-1build1 amd64 Pattern scanning and text processing language
ii patch 2.7.6-7build3 amd64 Apply a diff file to an original ii media-types 10.1.0 all List of standard media types and their usual file extension
ii patchelf 0.18.0-1.1build1 amd64 modify properties of ELF executables ii minify 2.20.17-1 amd64 CLI implementation of the Go minify library package
ii patchutils 0.4.2-1build3 amd64 Utilities to work with patches ii mksh 59c-37 amd64 MirBSD Korn Shell
ii pax-utils 1.3.7-1 amd64 Security-focused ELF files checking tool ii moreutils 0.69-1 amd64 additional Unix utilities
ii perl 5.38.2-3.2ubuntu0.1 amd64 Larry Wall's Practical Extraction and Report Language ii mount 2.39.3-9ubuntu6.3 amd64 tools for mounting and manipulating filesystems
ii perl-base 5.38.2-3.2ubuntu0.1 amd64 minimal Perl system ii musl:amd64 1.2.4-2 amd64 standard C library
ii perl-modules-5.38 5.38.2-3.2ubuntu0.1 all Core Perl modules ii ncurses-base 6.4+20240113-1ubuntu2 all basic terminal type definitions
ii procps 2:4.0.4-4ubuntu3.2 amd64 /proc file system utilities ii ncurses-bin 6.4+20240113-1ubuntu2 amd64 terminal-related programs and man pages
ii proot 5.1.0-1.3 amd64 emulate chroot, bind mount and binfmt_misc for non-root users ii ncurses-term 6.4+20240113-1ubuntu2 all additional terminal type definitions
ii python2.7-minimal 2.7.18-8+deb11u1 amd64 Minimal subset of the Python language (version 2.7) ii neovim 0.9.5-6ubuntu2 amd64 heavily refactored vim fork
ii python3 3.12.3-0ubuntu2 amd64 interactive high-level object-oriented language (default python3 version) ii neovim-runtime 0.9.5-6ubuntu2 all heavily refactored vim fork (runtime files)
ii python3-argcomplete 3.1.4-1ubuntu0.1 all bash tab completion for argparse (for Python 3) ii netbase 6.4 all Basic TCP/IP networking system
ii python3-minimal 3.12.3-0ubuntu2 amd64 minimal subset of the Python language (default python3 version) ii ninja-build 1.11.1-2 amd64 small build system closest in spirit to Make
ii python3-pyasn1 0.4.8-4 all ASN.1 library for Python (Python 3 module) ii openssl 3.0.13-0ubuntu3.6 amd64 Secure Sockets Layer toolkit - cryptographic utility
ii python3-pycryptodome 3.20.0+dfsg-1 amd64 cryptographic Python library (Python 3) ii p7zip 16.02+transitional.1 all transitional package
ii python3-pycurl 7.45.3-1build2 amd64 Python bindings to libcurl (Python 3) ii parallel 20231122+ds-1 all build and execute command lines from standard input in parallel
ii python3-pyelftools 0.30-1 all pure-python3 library for parsing ELF and DWARF ii passwd 1:4.13+dfsg1-4ubuntu3.2 amd64 change and administer password and group data
ii python3-toml 0.10.2-1 all library for Tom's Obvious, Minimal Language - Python 3.x ii patch 2.7.6-7build3 amd64 Apply a diff file to an original
ii python3-tomli 2.0.1-2 all lil' TOML parser for Python ii patchelf 0.18.0-1.1build1 amd64 modify properties of ELF executables
ii python3-tomli-w 1.0.0-2 all lil' TOML writer for Python ii patchutils 0.4.2-1build3 amd64 Utilities to work with patches
ii python3-xmltodict 0.13.0-1 all Makes working with XML feel like you are working with JSON (Python 3) ii pax-utils 1.3.7-1 amd64 Security-focused ELF files checking tool
ii python3-yaml 6.0.1-2build2 amd64 YAML parser and emitter for Python3 ii perl 5.38.2-3.2ubuntu0.2 amd64 Larry Wall's Practical Extraction and Report Language
ii python3-zstd 1.5.5.1-1build1 amd64 python bindings to Yann Collet ZSTD compression library ii perl-base 5.38.2-3.2ubuntu0.2 amd64 minimal Perl system
ii python3.12 3.12.3-1ubuntu0.7 amd64 Interactive high-level object-oriented language (version 3.12) ii perl-modules-5.38 5.38.2-3.2ubuntu0.2 all Core Perl modules
ii python3.12-minimal 3.12.3-1ubuntu0.7 amd64 Minimal subset of the Python language (version 3.12) ii procps 2:4.0.4-4ubuntu3.2 amd64 /proc file system utilities
ii re2c 3.1-1build1 amd64 lexer generator for C, C++, Go and Rust ii proot 5.1.0-1.3 amd64 emulate chroot, bind mount and binfmt_misc for non-root users
ii readline-common 8.2-4build1 all GNU readline and history libraries, common files ii python2.7-minimal 2.7.18-8+deb11u1 amd64 Minimal subset of the Python language (version 2.7)
ii ripgrep 14.1.0-1 amd64 Recursively searches directories for a regex pattern ii python3 3.12.3-0ubuntu2 amd64 interactive high-level object-oriented language (default python3 version)
ii rpcsvc-proto 1.4.2-0ubuntu7 amd64 RPC protocol compiler and definitions ii python3-argcomplete 3.1.4-1ubuntu0.1 all bash tab completion for argparse (for Python 3)
ii rsync 3.2.7-1ubuntu1.2 amd64 fast, versatile, remote (and local) file-copying tool ii python3-minimal 3.12.3-0ubuntu2 amd64 minimal subset of the Python language (default python3 version)
ii screen 4.9.1-1build1 amd64 terminal multiplexer with VT100/ANSI terminal emulation ii python3-pyasn1 0.4.8-4 all ASN.1 library for Python (Python 3 module)
ii sed 4.9-2build1 amd64 GNU stream editor for filtering/transforming text ii python3-pycryptodome 3.20.0+dfsg-1 amd64 cryptographic Python library (Python 3)
ii sensible-utils 0.0.22 all Utilities for sensible alternative selection ii python3-pycurl 7.45.3-1build2 amd64 Python bindings to libcurl (Python 3)
ii socat 1.8.0.0-4build3 amd64 multipurpose relay for bidirectional data transfer ii python3-pyelftools 0.30-1 all pure-python3 library for parsing ELF and DWARF
ii strace 6.8-0ubuntu2 amd64 System call tracer ii python3-toml 0.10.2-1 all library for Tom's Obvious, Minimal Language - Python 3.x
ii sudo 1.9.15p5-3ubuntu5.24.04.1 amd64 Provide limited super user privileges to specific users ii python3-tomli 2.0.1-2 all lil' TOML parser for Python
ii sysstat 12.6.1-2 amd64 system performance tools for Linux ii python3-tomli-w 1.0.0-2 all lil' TOML writer for Python
ii sysvinit-utils 3.08-6ubuntu3 amd64 System-V-like utilities ii python3-xmltodict 0.13.0-1ubuntu0.24.04.1 all Makes working with XML feel like you are working with JSON (Python 3)
ii tar 1.35+dfsg-3build1 amd64 GNU version of the tar archiving utility ii python3-yaml 6.0.1-2build2 amd64 YAML parser and emitter for Python3
ii time 1.9-0.2build1 amd64 GNU time program for measuring CPU resource usage ii python3-zstd 1.5.5.1-1build1 amd64 python bindings to Yann Collet ZSTD compression library
ii tzdata 2025b-0ubuntu0.24.04.1 all time zone and daylight-saving time data ii python3.12 3.12.3-1ubuntu0.8 amd64 Interactive high-level object-oriented language (version 3.12)
ii ubuntu-keyring 2023.11.28.1 all GnuPG keys of the Ubuntu archive ii python3.12-minimal 3.12.3-1ubuntu0.8 amd64 Minimal subset of the Python language (version 3.12)
ii ucf 3.0043+nmu1 all Update Configuration File(s): preserve user changes to config files ii re2c 3.1-1build1 amd64 lexer generator for C, C++, Go and Rust
ii universal-ctags 5.9.20210829.0-1 amd64 build tag file indexes of source code definitions ii readline-common 8.2-4build1 all GNU readline and history libraries, common files
ii unzip 6.0-28ubuntu4.1 amd64 De-archiver for .zip files ii ripgrep 14.1.0-1 amd64 Recursively searches directories for a regex pattern
ii util-linux 2.39.3-9ubuntu6.3 amd64 miscellaneous system utilities ii rpcsvc-proto 1.4.2-0ubuntu7 amd64 RPC protocol compiler and definitions
ii valgrind 1:3.22.0-0ubuntu3 amd64 instrumentation framework for building dynamic analysis tools ii rsync 3.2.7-1ubuntu1.2 amd64 fast, versatile, remote (and local) file-copying tool
ii wget 1.21.4-1ubuntu4.1 amd64 retrieves files from the web ii screen 4.9.1-1build1 amd64 terminal multiplexer with VT100/ANSI terminal emulation
ii xz-utils 5.6.1+really5.4.5-1ubuntu0.2 amd64 XZ-format compression utilities ii sed 4.9-2build1 amd64 GNU stream editor for filtering/transforming text
ii yash 2.55-2 amd64 yet another shell ii sensible-utils 0.0.22 all Utilities for sensible alternative selection
ii yq 3.1.0-3 all Command-line YAML processor - jq wrapper for YAML documents ii socat 1.8.0.0-4build3 amd64 multipurpose relay for bidirectional data transfer
ii zip 3.0-13ubuntu0.2 amd64 Archiver for .zip files ii strace 6.8-0ubuntu2 amd64 System call tracer
ii zlib1g-dev:amd64 1:1.3.dfsg-3.1ubuntu2.1 amd64 compression library - development ii sudo 1.9.15p5-3ubuntu5.24.04.1 amd64 Provide limited super user privileges to specific users
ii zlib1g:amd64 1:1.3.dfsg-3.1ubuntu2.1 amd64 compression library - runtime ii sysstat 12.6.1-2 amd64 system performance tools for Linux
ii zlib1g:i386 1:1.3.dfsg-3.1ubuntu2.1 i386 compression library - runtime ii sysvinit-utils 3.08-6ubuntu3 amd64 System-V-like utilities
ii zoxide 0.9.3-1 amd64 Smarter cd command for your terminal ii tar 1.35+dfsg-3build1 amd64 GNU version of the tar archiving utility
ii zsh 5.9-6ubuntu2 amd64 shell with lots of features ii time 1.9-0.2build1 amd64 GNU time program for measuring CPU resource usage
ii zsh-common 5.9-6ubuntu2 all architecture independent files for Zsh ii tzdata 2025b-0ubuntu0.24.04.1 all time zone and daylight-saving time data
ii zstd 1.5.5+dfsg2-2build1.1 amd64 fast lossless compression algorithm -- CLI tool ii ubuntu-keyring 2023.11.28.1 all GnuPG keys of the Ubuntu archive
ii ucf 3.0043+nmu1 all Update Configuration File(s): preserve user changes to config files
ii universal-ctags 5.9.20210829.0-1 amd64 build tag file indexes of source code definitions
ii unminimize 0.2.1 amd64 Un-minimize your minimial images or setup
ii unzip 6.0-28ubuntu4.1 amd64 De-archiver for .zip files
ii util-linux 2.39.3-9ubuntu6.3 amd64 miscellaneous system utilities
ii valgrind 1:3.22.0-0ubuntu3 amd64 instrumentation framework for building dynamic analysis tools
ii wget 1.21.4-1ubuntu4.1 amd64 retrieves files from the web
ii xz-utils 5.6.1+really5.4.5-1ubuntu0.2 amd64 XZ-format compression utilities
ii yash 2.55-2 amd64 yet another shell
ii yq 3.1.0-3 all Command-line YAML processor - jq wrapper for YAML documents
ii zip 3.0-13ubuntu0.2 amd64 Archiver for .zip files
ii zlib1g-dev:amd64 1:1.3.dfsg-3.1ubuntu2.1 amd64 compression library - development
ii zlib1g:amd64 1:1.3.dfsg-3.1ubuntu2.1 amd64 compression library - runtime
ii zlib1g:i386 1:1.3.dfsg-3.1ubuntu2.1 i386 compression library - runtime
ii zoxide 0.9.3-1 amd64 Smarter cd command for your terminal
ii zsh 5.9-6ubuntu2 amd64 shell with lots of features
ii zsh-common 5.9-6ubuntu2 all architecture independent files for Zsh
ii zstd 1.5.5+dfsg2-2build1.1 amd64 fast lossless compression algorithm -- CLI tool
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description ||/ Name Version Architecture Description
Packages sorted by Installed-Size: Packages sorted by Installed-Size:
1023146 ===== TOTAL (372 packages) 1156978 ===== TOTAL (390 packages)
76943 valgrind amd64 76943 valgrind amd64
61804 gcc-13-riscv64-linux-gnu amd64
61333 gcc-13-x86-64-linux-gnu amd64 61333 gcc-13-x86-64-linux-gnu amd64
44381 gh amd64 44381 gh amd64
36493 cmake amd64 36493 cmake amd64
35919 libicu74 amd64 35919 libicu74 amd64
33545 g++-13-x86-64-linux-gnu amd64 33545 g++-13-x86-64-linux-gnu amd64
30811 cpp-13-x86-64-linux-gnu amd64 30811 cpp-13-x86-64-linux-gnu amd64
29327 libperl5.38t64 amd64 29774 cpp-13-riscv64-linux-gnu amd64
29333 libperl5.38t64 amd64
21815 neovim-runtime all 21815 neovim-runtime all
21692 git amd64 21692 git amd64
21662 libstdc++-13-dev amd64 21662 libstdc++-13-dev amd64
19159 perl-modules-5.38 all 19159 perl-modules-5.38 all
18028 libgcc-13-dev-riscv64-cross all
16248 zsh-common all 16248 zsh-common all
16082 libgcc-13-dev amd64 16082 libgcc-13-dev amd64
13431 libc6 amd64 13431 libc6 amd64
@@ -401,23 +437,25 @@ Packages sorted by Installed-Size:
12004 libc6-x32 amd64 12004 libc6-x32 amd64
11989 libc6-i386 amd64 11989 libc6-i386 amd64
11549 binutils-x86-64-linux-gnu amd64 11549 binutils-x86-64-linux-gnu amd64
11172 libc6-dbg amd64 11179 libc6-dbg amd64
10984 cmake-data all 10984 cmake-data all
10791 libasan8 amd64 10791 libasan8 amd64
9704 libx32asan8 amd64 9704 libx32asan8 amd64
9539 lib32asan8 amd64 9539 lib32asan8 amd64
9022 libpython3.12-stdlib amd64 9420 binutils-riscv64-linux-gnu amd64
9023 libpython3.12-stdlib amd64
8924 libpython3.12t64 amd64 8924 libpython3.12t64 amd64
8902 libtsan2 amd64 8902 libtsan2 amd64
8335 libmagic-mgc amd64 8335 libmagic-mgc amd64
8296 lib32gcc-13-dev amd64 8296 lib32gcc-13-dev amd64
8119 libc6-dev-x32 amd64 8119 libc6-dev-x32 amd64
7926 python3.12-minimal amd64 7927 python3.12-minimal amd64
7913 perl-base amd64 7913 perl-base amd64
7531 libx32gcc-13-dev amd64 7531 libx32gcc-13-dev amd64
7460 linux-libc-dev amd64 7493 linux-libc-dev amd64
7226 lib32stdc++-13-dev amd64 7226 lib32stdc++-13-dev amd64
7059 libx32stdc++-13-dev amd64 7059 libx32stdc++-13-dev amd64
7025 linux-libc-dev-riscv64-cross all
7024 direnv amd64 7024 direnv amd64
6947 libc6-dev-i386 amd64 6947 libc6-dev-i386 amd64
6944 coreutils amd64 6944 coreutils amd64
@@ -427,7 +465,7 @@ Packages sorted by Installed-Size:
6158 7zip amd64 6158 7zip amd64
5219 bat amd64 5219 bat amd64
5210 ripgrep amd64 5210 ripgrep amd64
5180 libpython3.12-minimal amd64 5181 libpython3.12-minimal amd64
4897 libhwasan0 amd64 4897 libhwasan0 amd64
4341 ncurses-term all 4341 ncurses-term all
4244 minify amd64 4244 minify amd64
@@ -451,6 +489,7 @@ Packages sorted by Installed-Size:
3364 libubsan1 amd64 3364 libubsan1 amd64
3249 libapt-pkg6.0t64 amd64 3249 libapt-pkg6.0t64 amd64
3181 libx32ubsan1 amd64 3181 libx32ubsan1 amd64
3181 libstdc++6-riscv64-cross all
3111 ksh93u+m amd64 3111 ksh93u+m amd64
3110 libstdc++6 amd64 3110 libstdc++6 amd64
3104 lib32ubsan1 amd64 3104 lib32ubsan1 amd64
@@ -460,6 +499,7 @@ Packages sorted by Installed-Size:
2894 lib32stdc++6 amd64 2894 lib32stdc++6 amd64
2810 libx32stdc++6 amd64 2810 libx32stdc++6 amd64
2785 libpython2.7-minimal amd64 2785 libpython2.7-minimal amd64
2642 libasan8-riscv64-cross all
2431 zsh amd64 2431 zsh amd64
2419 passwd amd64 2419 passwd amd64
2352 libgnutls30t64 amd64 2352 libgnutls30t64 amd64
@@ -511,6 +551,7 @@ Packages sorted by Installed-Size:
905 libarchive13t64 amd64 905 libarchive13t64 amd64
884 login amd64 884 login amd64
852 busybox amd64 852 busybox amd64
851 libubsan1-riscv64-cross all
843 libbrotli1 amd64 843 libbrotli1 amd64
812 lua-luv amd64 812 lua-luv amd64
785 musl amd64 785 musl amd64
@@ -519,7 +560,7 @@ Packages sorted by Installed-Size:
761 libzstd1 amd64 761 libzstd1 amd64
751 libsepol2 amd64 751 libsepol2 amd64
745 libsource-highlight4t64 amd64 745 libsource-highlight4t64 amd64
736 python3.12 amd64 737 python3.12 amd64
732 xz-utils amd64 732 xz-utils amd64
708 tar amd64 708 tar amd64
672 perl amd64 672 perl amd64
@@ -560,6 +601,7 @@ Packages sorted by Installed-Size:
375 unzip amd64 375 unzip amd64
373 libgomp1 amd64 373 libgomp1 amd64
367 libmount1 amd64 367 libmount1 amd64
362 libgomp1-riscv64-cross all
358 libjq1 amd64 358 libjq1 amd64
357 bfs amd64 357 bfs amd64
355 ninja-build amd64 355 ninja-build amd64
@@ -639,6 +681,7 @@ Packages sorted by Installed-Size:
151 libaudit1 amd64 151 libaudit1 amd64
150 python3-argcomplete all 150 python3-argcomplete all
149 libmpc3 amd64 149 libmpc3 amd64
149 libitm1-riscv64-cross all
148 libsasl2-2 amd64 148 libsasl2-2 amd64
148 libcc1-0 amd64 148 libcc1-0 amd64
143 libyaml-0-2 amd64 143 libyaml-0-2 amd64
@@ -646,6 +689,7 @@ Packages sorted by Installed-Size:
137 librtmp1 amd64 137 librtmp1 amd64
136 libhiredis1.1.0 amd64 136 libhiredis1.1.0 amd64
133 libkrb5support0 amd64 133 libkrb5support0 amd64
133 libgcc-s1-riscv64-cross all
131 libipt2 amd64 131 libipt2 amd64
130 init-system-helpers all 130 init-system-helpers all
130 bubblewrap amd64 130 bubblewrap amd64
@@ -657,6 +701,7 @@ Packages sorted by Installed-Size:
120 libpopt0 amd64 120 libpopt0 amd64
115 libitm1 amd64 115 libitm1 amd64
115 libapparmor1 amd64 115 libapparmor1 amd64
113 gcc-13-riscv64-linux-gnu-base amd64
113 gcc-13-base amd64 113 gcc-13-base amd64
112 jq amd64 112 jq amd64
112 gcc-14-base i386 112 gcc-14-base i386
@@ -667,7 +712,9 @@ Packages sorted by Installed-Size:
107 sysvinit-utils amd64 107 sysvinit-utils amd64
107 libwrap0 amd64 107 libwrap0 amd64
106 libc-dev-bin amd64 106 libc-dev-bin amd64
106 gcc-13-cross-base all
105 lib32itm1 amd64 105 lib32itm1 amd64
105 gcc-14-cross-base all
103 libio-pty-perl amd64 103 libio-pty-perl amd64
100 libassuan0 amd64 100 libassuan0 amd64
99 libpsl5t64 amd64 99 libpsl5t64 amd64
@@ -714,9 +761,9 @@ Packages sorted by Installed-Size:
51 logsave amd64 51 logsave amd64
51 libutempter0 amd64 51 libutempter0 amd64
51 libdebuginfod-common all 51 libdebuginfod-common all
49 python3-xmltodict all
49 libatomic1 amd64 49 libatomic1 amd64
48 libmsgpackc2 amd64 48 libmsgpackc2 amd64
47 python3-xmltodict all
47 libx32atomic1 amd64 47 libx32atomic1 amd64
47 libsigsegv2 amd64 47 libsigsegv2 amd64
46 hostname amd64 46 hostname amd64
@@ -724,6 +771,7 @@ Packages sorted by Installed-Size:
42 libnpth0t64 amd64 42 libnpth0t64 amd64
41 libxdmcp6 amd64 41 libxdmcp6 amd64
41 libkeyutils1 amd64 41 libkeyutils1 amd64
40 libatomic1-riscv64-cross all
39 lib32atomic1 amd64 39 lib32atomic1 amd64
38 libdebconfclient0 amd64 38 libdebconfclient0 amd64
37 gcc amd64 37 gcc amd64
@@ -740,14 +788,17 @@ Packages sorted by Installed-Size:
26 libsemanage-common all 26 libsemanage-common all
25 libsensors-config all 25 libsensors-config all
25 gcc-x86-64-linux-gnu amd64 25 gcc-x86-64-linux-gnu amd64
25 gcc-riscv64-linux-gnu amd64
20 cpp-x86-64-linux-gnu amd64 20 cpp-x86-64-linux-gnu amd64
20 cpp-riscv64-linux-gnu amd64
17 lsb-release all 17 lsb-release all
17 libaudit-common all 17 libaudit-common all
16 unminimize amd64
13 g++ amd64 13 g++ amd64
11 g++-x86-64-linux-gnu amd64 11 g++-x86-64-linux-gnu amd64
11 cpp-13 amd64 11 cpp-13 amd64
8 p7zip all 8 p7zip all
8 gcc-multilib amd64
6 gcc-13-multilib amd64 6 gcc-13-multilib amd64
6 g++-multilib amd64
6 g++-13-multilib amd64 6 g++-13-multilib amd64
0 libc6-riscv64-cross all
0 libc6-dev-riscv64-cross all
+1
View File
@@ -48,6 +48,7 @@ run_upx=( "${emu[@]}" "$upx_exe" )
echo "run_upx='${run_upx[*]}'" echo "run_upx='${run_upx[*]}'"
# run_upx sanity check # run_upx sanity check
"${run_upx[@]}" --version-short || true
if ! "${run_upx[@]}" --version-short >/dev/null; then echo "UPX-ERROR: FATAL: upx --version-short FAILED"; exit 1; fi if ! "${run_upx[@]}" --version-short >/dev/null; then echo "UPX-ERROR: FATAL: upx --version-short FAILED"; exit 1; fi
if ! "${run_upx[@]}" -L >/dev/null 2>&1; then echo "UPX-ERROR: FATAL: upx -L FAILED"; exit 1; fi if ! "${run_upx[@]}" -L >/dev/null 2>&1; then echo "UPX-ERROR: FATAL: upx -L FAILED"; exit 1; fi
if ! "${run_upx[@]}" --help >/dev/null; then echo "UPX-ERROR: FATAL: upx --help FAILED"; exit 1; fi if ! "${run_upx[@]}" --help >/dev/null; then echo "UPX-ERROR: FATAL: upx --help FAILED"; exit 1; fi
+6
View File
@@ -9,6 +9,12 @@
Memcheck:Cond Memcheck:Cond
fun:enframe fun:enframe
} }
{
musl-malloc-get_nominal_size
Memcheck:Cond
fun:get_nominal_size
fun:__libc_free
}
# these are only needed for older musl versions # these are only needed for older musl versions
+19 -3
View File
@@ -295,13 +295,15 @@ forceinline constexpr upx_uint64_t no_bswap64(upx_uint64_t v) noexcept { return
#define ne16_to_le16(v) bswap16(v) #define ne16_to_le16(v) bswap16(v)
#define ne32_to_le32(v) bswap32(v) #define ne32_to_le32(v) bswap32(v)
#define ne64_to_le64(v) bswap64(v) #define ne64_to_le64(v) bswap64(v)
#else #elif (ACC_ABI_LITTLE_ENDIAN)
#define ne16_to_be16(v) bswap16(v) #define ne16_to_be16(v) bswap16(v)
#define ne32_to_be32(v) bswap32(v) #define ne32_to_be32(v) bswap32(v)
#define ne64_to_be64(v) bswap64(v) #define ne64_to_be64(v) bswap64(v)
#define ne16_to_le16(v) no_bswap16(v) #define ne16_to_le16(v) no_bswap16(v)
#define ne32_to_le32(v) no_bswap32(v) #define ne32_to_le32(v) no_bswap32(v)
#define ne64_to_le64(v) no_bswap64(v) #define ne64_to_le64(v) no_bswap64(v)
#else
#error "ACC_ABI_ENDIAN"
#endif #endif
/************************************************************************* /*************************************************************************
@@ -360,8 +362,12 @@ inline constexpr unsigned get_be24(const byte *p) noexcept {
inline constexpr unsigned get_le24(const byte *p) noexcept { inline constexpr unsigned get_le24(const byte *p) noexcept {
return upx::compile_time::get_le24(p); return upx::compile_time::get_le24(p);
} }
inline constexpr unsigned get_ne24(const byte *p) noexcept {
return upx::compile_time::get_ne24(p);
}
inline constexpr void set_be24(byte *p, unsigned v) noexcept { upx::compile_time::set_be24(p, v); } inline constexpr void set_be24(byte *p, unsigned v) noexcept { upx::compile_time::set_be24(p, v); }
inline constexpr void set_le24(byte *p, unsigned v) noexcept { upx::compile_time::set_le24(p, v); } inline constexpr void set_le24(byte *p, unsigned v) noexcept { upx::compile_time::set_le24(p, v); }
inline constexpr void set_ne24(byte *p, unsigned v) noexcept { upx::compile_time::set_ne24(p, v); }
REQUIRE_XE24 REQUIRE_XE24
forceinline bele_constexpr unsigned get_be24(const XE24 *p) noexcept { forceinline bele_constexpr unsigned get_be24(const XE24 *p) noexcept {
@@ -372,6 +378,10 @@ forceinline bele_constexpr unsigned get_le24(const XE24 *p) noexcept {
return get_le24(upx::ptr_static_cast<const byte *>(p)); return get_le24(upx::ptr_static_cast<const byte *>(p));
} }
REQUIRE_XE24 REQUIRE_XE24
forceinline bele_constexpr unsigned get_ne24(const XE24 *p) noexcept {
return get_ne24(upx::ptr_static_cast<const byte *>(p));
}
REQUIRE_XE24
forceinline bele_constexpr void set_be24(XE24 *p, unsigned v) noexcept { forceinline bele_constexpr void set_be24(XE24 *p, unsigned v) noexcept {
set_be24(upx::ptr_static_cast<byte *>(p), v); set_be24(upx::ptr_static_cast<byte *>(p), v);
} }
@@ -379,6 +389,10 @@ REQUIRE_XE24
forceinline bele_constexpr void set_le24(XE24 *p, unsigned v) noexcept { forceinline bele_constexpr void set_le24(XE24 *p, unsigned v) noexcept {
set_le24(upx::ptr_static_cast<byte *>(p), v); set_le24(upx::ptr_static_cast<byte *>(p), v);
} }
REQUIRE_XE24
forceinline bele_constexpr void set_ne24(XE24 *p, unsigned v) noexcept {
set_ne24(upx::ptr_static_cast<byte *>(p), v);
}
REQUIRE_XE32 REQUIRE_XE32
inline bele_constexpr unsigned get_le26(const XE32 *p) noexcept { return get_le32(p) & 0x03ffffff; } inline bele_constexpr unsigned get_le26(const XE32 *p) noexcept { return get_le32(p) & 0x03ffffff; }
@@ -1085,7 +1099,7 @@ TT_UPX_IS_INTEGRAL(LE32);
TT_UPX_IS_INTEGRAL(LE64); TT_UPX_IS_INTEGRAL(LE64);
#undef TT_UPX_IS_INTEGRAL #undef TT_UPX_IS_INTEGRAL
// native types // NE - Native Endianness (aka Host Endianness aka CPU Endianness)
#if (ACC_ABI_BIG_ENDIAN) #if (ACC_ABI_BIG_ENDIAN)
typedef BE16 NE16; typedef BE16 NE16;
typedef BE32 NE32; typedef BE32 NE32;
@@ -1096,7 +1110,7 @@ typedef BE64 NE64;
#define ne16_compare_signed be16_compare_signed #define ne16_compare_signed be16_compare_signed
#define ne32_compare_signed be32_compare_signed #define ne32_compare_signed be32_compare_signed
#define ne64_compare_signed be64_compare_signed #define ne64_compare_signed be64_compare_signed
#else #elif (ACC_ABI_LITTLE_ENDIAN)
typedef LE16 NE16; typedef LE16 NE16;
typedef LE32 NE32; typedef LE32 NE32;
typedef LE64 NE64; typedef LE64 NE64;
@@ -1106,6 +1120,8 @@ typedef LE64 NE64;
#define ne16_compare_signed le16_compare_signed #define ne16_compare_signed le16_compare_signed
#define ne32_compare_signed le32_compare_signed #define ne32_compare_signed le32_compare_signed
#define ne64_compare_signed le64_compare_signed #define ne64_compare_signed le64_compare_signed
#else
#error "ACC_ABI_ENDIAN"
#endif #endif
/************************************************************************* /*************************************************************************
+3 -3
View File
@@ -135,7 +135,7 @@ struct BEPolicy final
S u32_compare_signed(const void *a, const void *b) C { return be32_compare_signed(a, b); } S u32_compare_signed(const void *a, const void *b) C { return be32_compare_signed(a, b); }
S u64_compare_signed(const void *a, const void *b) C { return be64_compare_signed(a, b); } S u64_compare_signed(const void *a, const void *b) C { return be64_compare_signed(a, b); }
static void compileTimeAssertions() { static void compileTimeAssertions() noexcept {
COMPILE_TIME_ASSERT(sizeof(U16) == 2) COMPILE_TIME_ASSERT(sizeof(U16) == 2)
COMPILE_TIME_ASSERT(sizeof(U32) == 4) COMPILE_TIME_ASSERT(sizeof(U32) == 4)
COMPILE_TIME_ASSERT(sizeof(U64) == 8) COMPILE_TIME_ASSERT(sizeof(U64) == 8)
@@ -194,7 +194,7 @@ struct LEPolicy final
S u32_compare_signed(const void *a, const void *b) C { return le32_compare_signed(a, b); } S u32_compare_signed(const void *a, const void *b) C { return le32_compare_signed(a, b); }
S u64_compare_signed(const void *a, const void *b) C { return le64_compare_signed(a, b); } S u64_compare_signed(const void *a, const void *b) C { return le64_compare_signed(a, b); }
static void compileTimeAssertions() { static void compileTimeAssertions() noexcept {
COMPILE_TIME_ASSERT(sizeof(U16) == 2) COMPILE_TIME_ASSERT(sizeof(U16) == 2)
COMPILE_TIME_ASSERT(sizeof(U32) == 4) COMPILE_TIME_ASSERT(sizeof(U32) == 4)
COMPILE_TIME_ASSERT(sizeof(U64) == 8) COMPILE_TIME_ASSERT(sizeof(U64) == 8)
@@ -210,7 +210,7 @@ private:
UPX_CXX_DISABLE_NEW_DELETE(LEPolicy) UPX_CXX_DISABLE_NEW_DELETE(LEPolicy)
}; };
// Native Endianness policy (aka Host Policy) // NE - Native Endianness policy (aka Host Policy)
#if (ACC_ABI_BIG_ENDIAN) #if (ACC_ABI_BIG_ENDIAN)
typedef BEPolicy NEPolicy; typedef BEPolicy NEPolicy;
typedef BEPolicy HostPolicy; typedef BEPolicy HostPolicy;
+8 -3
View File
@@ -262,7 +262,7 @@ ASSERT_SAME_TYPE(short, upx_int16_t);
ASSERT_SAME_TYPE(unsigned short, upx_uint16_t); ASSERT_SAME_TYPE(unsigned short, upx_uint16_t);
ASSERT_SAME_TYPE(int, upx_int32_t); ASSERT_SAME_TYPE(int, upx_int32_t);
ASSERT_SAME_TYPE(unsigned, upx_uint32_t); ASSERT_SAME_TYPE(unsigned, upx_uint32_t);
#if (__SIZEOF_LONG_LONG__ + 0 < 128) #if (__SIZEOF_LONG_LONG__ + 0 < 16)
ASSERT_SAME_TYPE(long long, upx_int64_t); ASSERT_SAME_TYPE(long long, upx_int64_t);
ASSERT_SAME_TYPE(unsigned long long, upx_uint64_t); ASSERT_SAME_TYPE(unsigned long long, upx_uint64_t);
#endif #endif
@@ -1104,11 +1104,11 @@ void upx_compiler_sanity_check(void) noexcept {
alignas(16) static constexpr const byte dd[32] = { alignas(16) static constexpr const byte dd[32] = {
0, 0, 0, 0, 0, 0, 0, 0xff, 0xfe, 0xfd, 0xfc, 0xfb, 0xfa, 0xf9, 0xf8, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xfe, 0xfd, 0xfc, 0xfb, 0xfa, 0xf9, 0xf8, 0,
0, 0, 0, 0x7f, 0x7e, 0x7d, 0x7c, 0x7b, 0x7a, 0x79, 0x78, 0, 0, 0, 0, 0}; 0, 0, 0, 0x7f, 0x7e, 0x7d, 0x7c, 0x7b, 0x7a, 0x79, 0x78, 0, 0, 0, 0, 0};
constexpr const byte *d = dd + 7;
#if !defined(upx_fake_alignas_16) #if !defined(upx_fake_alignas_16)
assert_noexcept(ptr_is_aligned<16>(dd)); assert_noexcept(ptr_is_aligned<16>(dd));
assert_noexcept(ptr_is_aligned(dd, 16)); assert_noexcept(ptr_is_aligned(dd, 16));
#endif #endif
constexpr const byte *d = dd + 7;
static_assert(upx::compile_time::get_be16(d) == 0xfffe); static_assert(upx::compile_time::get_be16(d) == 0xfffe);
static_assert(upx::compile_time::get_be24(d) == 0xfffefd); static_assert(upx::compile_time::get_be24(d) == 0xfffefd);
static_assert(upx::compile_time::get_be32(d) == 0xfffefdfc); static_assert(upx::compile_time::get_be32(d) == 0xfffefdfc);
@@ -1292,6 +1292,9 @@ void upx_compiler_sanity_check(void) noexcept {
assert_noexcept(testNoAliasing(&u.v_int, &u.v_llong)); assert_noexcept(testNoAliasing(&u.v_int, &u.v_llong));
assert_noexcept(testNoAliasing(&u.v_long, &u.v_llong)); assert_noexcept(testNoAliasing(&u.v_long, &u.v_llong));
#if 1 && (ACC_CC_MSC) && (defined(_M_ARM64) || defined(_M_ARM64EC))
// @COMPILER_BUG @MSVC_BUG
#else
assert_noexcept(TestIntegerWrap<unsigned>::inc_gt(0)); assert_noexcept(TestIntegerWrap<unsigned>::inc_gt(0));
assert_noexcept(!TestIntegerWrap<unsigned>::inc_gt(UINT_MAX)); assert_noexcept(!TestIntegerWrap<unsigned>::inc_gt(UINT_MAX));
assert_noexcept(TestIntegerWrap<unsigned>::dec_lt(1)); assert_noexcept(TestIntegerWrap<unsigned>::dec_lt(1));
@@ -1308,6 +1311,7 @@ void upx_compiler_sanity_check(void) noexcept {
assert_noexcept(!TestIntegerWrap<int>::neg_eq(1)); assert_noexcept(!TestIntegerWrap<int>::neg_eq(1));
assert_noexcept(!TestIntegerWrap<int>::neg_eq(INT_MAX)); assert_noexcept(!TestIntegerWrap<int>::neg_eq(INT_MAX));
assert_noexcept(TestIntegerWrap<int>::neg_eq(INT_MIN)); // special case assert_noexcept(TestIntegerWrap<int>::neg_eq(INT_MIN)); // special case
#endif
} }
/************************************************************************* /*************************************************************************
@@ -1463,7 +1467,8 @@ TEST_CASE("libc qsort") {
return true; return true;
} }
}; };
constexpr size_t N = 4096;
constexpr size_t N = 256;
Elem e[N]; Elem e[N];
for (size_t n = 0; n <= N; n = 2 * n + 1) { for (size_t n = 0; n <= N; n = 2 * n + 1) {
// system sort functions // system sort functions
+2
View File
@@ -68,7 +68,9 @@
#endif #endif
#endif #endif
// NOLINTBEGIN(bugprone-unintended-char-ostream-output)
#include <doctest/doctest/parts/doctest.cpp> #include <doctest/doctest/parts/doctest.cpp>
// NOLINTEND(bugprone-unintended-char-ostream-output)
#endif // DOCTEST_CONFIG_DISABLE #endif // DOCTEST_CONFIG_DISABLE
+189 -6
View File
@@ -101,9 +101,6 @@ TEST_CASE("basic xspan usage") {
CHECK(b0.raw_size_in_bytes() == 0u); CHECK(b0.raw_size_in_bytes() == 0u);
CHECK(bp.raw_size_in_bytes() == 0u); CHECK(bp.raw_size_in_bytes() == 0u);
#endif #endif
CHECK(raw_bytes(b0, 999999) == buf);
CHECK(raw_bytes(bp, 999999) == buf);
CHECK(raw_bytes(c0, 4) == buf); CHECK(raw_bytes(c0, 4) == buf);
CHECK(raw_index_bytes(c0, 1, 3) == buf + 1); CHECK(raw_index_bytes(c0, 1, 3) == buf + 1);
CHECK(raw_bytes(cp, 4) == buf); CHECK(raw_bytes(cp, 4) == buf);
@@ -180,9 +177,6 @@ TEST_CASE("basic xspan usage") {
CHECK(b0.raw_size_in_bytes() == 0u); CHECK(b0.raw_size_in_bytes() == 0u);
CHECK(bp.raw_size_in_bytes() == 0u); CHECK(bp.raw_size_in_bytes() == 0u);
#endif #endif
CHECK(raw_bytes(b0, 999999) == buf);
CHECK(raw_bytes(bp, 999999) == buf);
CHECK(raw_bytes(c0, 4) == buf); CHECK(raw_bytes(c0, 4) == buf);
CHECK(raw_index_bytes(c0, 1, 3) == buf + 1); CHECK(raw_index_bytes(c0, 1, 3) == buf + 1);
CHECK(raw_bytes(cp, 4) == buf); CHECK(raw_bytes(cp, 4) == buf);
@@ -876,6 +870,195 @@ TEST_CASE("PtrOrSpan int") {
CHECK(a == buf + 8); CHECK(a == buf + 8);
} }
/*************************************************************************
//
**************************************************************************/
#ifdef UPX_VERSION_HEX
namespace {
template <class T>
static noinline void check_bele_a(const T &mb, size_t i) {
if (i < 2) {
CHECK_THROWS(get_ne16(mb));
CHECK_THROWS(get_be16(mb));
CHECK_THROWS(get_le16(mb));
CHECK_THROWS(set_ne16(mb, 0));
CHECK_THROWS(set_be16(mb, 0));
CHECK_THROWS(set_le16(mb, 0));
} else {
CHECK_NOTHROW(get_ne16(mb));
CHECK_NOTHROW(get_be16(mb));
CHECK_NOTHROW(get_le16(mb));
CHECK_NOTHROW(set_ne16(mb, 0));
CHECK_NOTHROW(set_be16(mb, 0));
CHECK_NOTHROW(set_le16(mb, 0));
}
if (i < 3) {
CHECK_THROWS(get_ne24(mb));
CHECK_THROWS(get_be24(mb));
CHECK_THROWS(get_le24(mb));
CHECK_THROWS(set_ne24(mb, 0));
CHECK_THROWS(set_be24(mb, 0));
CHECK_THROWS(set_le24(mb, 0));
} else {
CHECK_NOTHROW(get_ne24(mb));
CHECK_NOTHROW(get_be24(mb));
CHECK_NOTHROW(get_le24(mb));
CHECK_NOTHROW(set_ne24(mb, 0));
CHECK_NOTHROW(set_be24(mb, 0));
CHECK_NOTHROW(set_le24(mb, 0));
}
if (i < 4) {
CHECK_THROWS(get_ne32(mb));
CHECK_THROWS(get_be32(mb));
CHECK_THROWS(get_le32(mb));
CHECK_THROWS(set_ne32(mb, 0));
CHECK_THROWS(set_be32(mb, 0));
CHECK_THROWS(set_le32(mb, 0));
} else {
CHECK_NOTHROW(get_ne32(mb));
CHECK_NOTHROW(get_be32(mb));
CHECK_NOTHROW(get_le32(mb));
CHECK_NOTHROW(set_ne32(mb, 0));
CHECK_NOTHROW(set_be32(mb, 0));
CHECK_NOTHROW(set_le32(mb, 0));
}
if (i < 8) {
CHECK_THROWS(get_ne64(mb));
CHECK_THROWS(get_be64(mb));
CHECK_THROWS(get_le64(mb));
CHECK_THROWS(set_ne64(mb, 0));
CHECK_THROWS(set_be64(mb, 0));
CHECK_THROWS(set_le64(mb, 0));
} else {
CHECK_NOTHROW(get_ne64(mb));
CHECK_NOTHROW(get_be64(mb));
CHECK_NOTHROW(get_le64(mb));
CHECK_NOTHROW(set_ne64(mb, 0));
CHECK_NOTHROW(set_be64(mb, 0));
CHECK_NOTHROW(set_le64(mb, 0));
}
}
template <class T>
static noinline void check_bele_c(const T &mb, size_t i) {
if (i < 2) {
CHECK_THROWS(get_ne16(mb));
CHECK_THROWS(get_be16(mb));
CHECK_THROWS(get_le16(mb));
} else {
CHECK_NOTHROW(get_ne16(mb));
CHECK_NOTHROW(get_be16(mb));
CHECK_NOTHROW(get_le16(mb));
}
if (i < 3) {
CHECK_THROWS(get_ne24(mb));
CHECK_THROWS(get_be24(mb));
CHECK_THROWS(get_le24(mb));
} else {
CHECK_NOTHROW(get_ne24(mb));
CHECK_NOTHROW(get_be24(mb));
CHECK_NOTHROW(get_le24(mb));
}
if (i < 4) {
CHECK_THROWS(get_ne32(mb));
CHECK_THROWS(get_be32(mb));
CHECK_THROWS(get_le32(mb));
} else {
CHECK_NOTHROW(get_ne32(mb));
CHECK_NOTHROW(get_be32(mb));
CHECK_NOTHROW(get_le32(mb));
}
if (i < 8) {
CHECK_THROWS(get_ne64(mb));
CHECK_THROWS(get_be64(mb));
CHECK_THROWS(get_le64(mb));
} else {
CHECK_NOTHROW(get_ne64(mb));
CHECK_NOTHROW(get_be64(mb));
CHECK_NOTHROW(get_le64(mb));
}
}
} // namespace
#endif // UPX_VERSION_HEX
TEST_CASE("xspan global overloads") {
byte buf_a[16] = {};
const byte buf_c[16] = {};
for (size_t i = 0; i < 16; i++) {
XSPAN_0_VAR(byte, a0, buf_a, i);
XSPAN_P_VAR(byte, ap, buf_a, i);
XSPAN_S_VAR(byte, as, buf_a, i);
XSPAN_0_VAR(const byte, c0, buf_c, i);
XSPAN_P_VAR(const byte, cp, buf_c, i);
XSPAN_S_VAR(const byte, cs, buf_c, i);
#ifdef UPX_VERSION_HEX
check_bele_a(a0, i);
check_bele_a(ap, i);
check_bele_a(as, i);
check_bele_c(c0, i);
check_bele_c(cp, i);
check_bele_c(cs, i);
CHECK_THROWS(upx_adler32(a0, i + 1));
CHECK_THROWS(upx_adler32(ap, i + 1));
CHECK_THROWS(upx_adler32(as, i + 1));
CHECK_THROWS(upx_adler32(c0, i + 1));
CHECK_THROWS(upx_adler32(cp, i + 1));
CHECK_THROWS(upx_adler32(cs, i + 1));
if (i == 0) {
CHECK_THROWS(upx_safe_strlen(a0));
CHECK_THROWS(upx_safe_strlen(ap));
CHECK_THROWS(upx_safe_strlen(as));
CHECK_THROWS(upx_safe_strlen(c0));
CHECK_THROWS(upx_safe_strlen(cp));
CHECK_THROWS(upx_safe_strlen(cs));
}
#endif
CHECK_THROWS(memchr(a0, 0, i + 1)); // NOLINT(bugprone-unused-return-value)
CHECK_THROWS(memchr(ap, 0, i + 1)); // NOLINT(bugprone-unused-return-value)
CHECK_THROWS(memchr(as, 0, i + 1)); // NOLINT(bugprone-unused-return-value)
CHECK_THROWS(memchr(c0, 0, i + 1)); // NOLINT(bugprone-unused-return-value)
CHECK_THROWS(memchr(cp, 0, i + 1)); // NOLINT(bugprone-unused-return-value)
CHECK_THROWS(memchr(cs, 0, i + 1)); // NOLINT(bugprone-unused-return-value)
CHECK(memcmp(a0, a0, i) == 0);
CHECK(memcmp(ap, a0, i) == 0);
CHECK(memcmp(as, a0, i) == 0);
CHECK_THROWS(memcmp(a0, a0, i + 1)); // NOLINT(bugprone-unused-return-value)
CHECK_THROWS(memcmp(ap, a0, i + 1)); // NOLINT(bugprone-unused-return-value)
CHECK_THROWS(memcmp(as, a0, i + 1)); // NOLINT(bugprone-unused-return-value)
CHECK_NOTHROW(memcpy(a0, c0, i));
CHECK_NOTHROW(memcpy(ap, cp, i));
CHECK_NOTHROW(memcpy(as, cs, i));
CHECK_THROWS(memcpy(a0, c0, i + 1));
CHECK_THROWS(memcpy(ap, cp, i + 1));
CHECK_THROWS(memcpy(as, cs, i + 1));
CHECK_NOTHROW(memmove(a0, c0, i));
CHECK_NOTHROW(memmove(ap, cp, i));
CHECK_NOTHROW(memmove(as, cs, i));
CHECK_THROWS(memmove(a0, c0, i + 1));
CHECK_THROWS(memmove(ap, cp, i + 1));
CHECK_THROWS(memmove(as, cs, i + 1));
CHECK_NOTHROW(memset(a0, 255, i));
CHECK_NOTHROW(memset(ap, 255, i));
CHECK_NOTHROW(memset(as, 255, i));
CHECK_THROWS(memset(a0, 254, i + 1));
CHECK_THROWS(memset(ap, 254, i + 1));
CHECK_THROWS(memset(as, 254, i + 1));
}
}
/************************************************************************* /*************************************************************************
// codegen // codegen
**************************************************************************/ **************************************************************************/
+3 -2
View File
@@ -248,8 +248,9 @@ static void __UCL_CDECL my_free(ucl_voidp p) { free(p); }
} // extern "C" } // extern "C"
int upx_ucl_init(void) { int upx_ucl_init(void) {
#if (ACC_CC_MSC && ACC_ARCH_I386) && (_MSC_VER >= 1940) #if 1 && (ACC_CC_MSC && ACC_ARCH_I386) && (_MSC_VER >= 1940)
(void) ucl_init(); // TODO later // @COMPILER_BUG @MSVC_BUG
(void) ucl_init();
#else #else
if (ucl_init() != UCL_E_OK) if (ucl_init() != UCL_E_OK)
return -1; return -1;
+11 -5
View File
@@ -100,6 +100,7 @@ static_assert((char) (-1) == 255); // -funsigned-char
#endif // UPX_CONFIG_DISABLE_WERROR #endif // UPX_CONFIG_DISABLE_WERROR
#endif // UPX_CONFIG_DISABLE_WSTRICT #endif // UPX_CONFIG_DISABLE_WSTRICT
// upx_is_constant_evaluated
#if __cplusplus >= 202002L // C++20 #if __cplusplus >= 202002L // C++20
#define upx_is_constant_evaluated std::is_constant_evaluated #define upx_is_constant_evaluated std::is_constant_evaluated
#elif __has_builtin(__builtin_is_constant_evaluated) // clang-9, gcc-10 #elif __has_builtin(__builtin_is_constant_evaluated) // clang-9, gcc-10
@@ -119,7 +120,7 @@ static_assert((char) (-1) == 255); // -funsigned-char
#define upx_std_atomic(Type) Type #define upx_std_atomic(Type) Type
#define upx_std_once_flag upx_std_atomic(size_t) #define upx_std_once_flag upx_std_atomic(size_t)
template <class NoexceptCallable> template <class NoexceptCallable>
inline void upx_std_call_once(upx_std_once_flag &flag, NoexceptCallable &&f) { inline void upx_std_call_once(upx_std_once_flag &flag, NoexceptCallable &&f) noexcept {
if (__acc_unlikely(!flag)) { if (__acc_unlikely(!flag)) {
flag = 1; flag = 1;
f(); f();
@@ -376,6 +377,7 @@ inline void NO_printf(const char *, ...) noexcept {}
inline void NO_fprintf(FILE *, const char *, ...) noexcept attribute_format(2, 3); inline void NO_fprintf(FILE *, const char *, ...) noexcept attribute_format(2, 3);
inline void NO_fprintf(FILE *, const char *, ...) noexcept {} inline void NO_fprintf(FILE *, const char *, ...) noexcept {}
// upx_memcmp_inline
#if __has_builtin(__builtin_memcmp) #if __has_builtin(__builtin_memcmp)
#define upx_memcmp_inline __builtin_memcmp #define upx_memcmp_inline __builtin_memcmp
#elif defined(__clang__) || defined(__GNUC__) #elif defined(__clang__) || defined(__GNUC__)
@@ -383,6 +385,8 @@ inline void NO_fprintf(FILE *, const char *, ...) noexcept {}
#else #else
#define upx_memcmp_inline memcmp #define upx_memcmp_inline memcmp
#endif #endif
// upx_memcpy_inline
#if __has_builtin(__builtin_memcpy_inline) && 0 // TODO later: clang constexpr limitation? #if __has_builtin(__builtin_memcpy_inline) && 0 // TODO later: clang constexpr limitation?
#define upx_memcpy_inline __builtin_memcpy_inline #define upx_memcpy_inline __builtin_memcpy_inline
#elif __has_builtin(__builtin_memcpy) #elif __has_builtin(__builtin_memcpy)
@@ -393,6 +397,7 @@ inline void NO_fprintf(FILE *, const char *, ...) noexcept {}
#define upx_memcpy_inline memcpy #define upx_memcpy_inline memcpy
#endif #endif
// upx_return_address()
#if defined(__wasi__) #if defined(__wasi__)
#define upx_return_address() nullptr #define upx_return_address() nullptr
#elif __has_builtin(__builtin_return_address) #elif __has_builtin(__builtin_return_address)
@@ -802,14 +807,15 @@ int upx_doctest_check();
// util/membuffer.h // util/membuffer.h
class MemBuffer; class MemBuffer;
void *membuffer_get_void_ptr(MemBuffer &mb) noexcept; void *membuffer_get_void_ptr(MemBuffer &mb) noexcept;
unsigned membuffer_get_size(MemBuffer &mb) noexcept; const void *membuffer_get_void_ptr(const MemBuffer &mb) noexcept;
unsigned membuffer_get_size_in_bytes(const MemBuffer &mb) noexcept;
// main.cpp // main.cpp
extern const char *progname; extern const char *progname;
bool main_set_exit_code(int ec); bool main_set_exit_code(int ec);
int main_get_options(int argc, char **argv); int main_get_options(int argc, char **argv);
void main_get_envoptions(); void main_get_envoptions();
int upx_main(int argc, char *argv[]) may_throw; noinline int upx_main(int argc, char *argv[]) may_throw;
// msg.cpp // msg.cpp
void printSetNl(int need_nl) noexcept; void printSetNl(int need_nl) noexcept;
@@ -826,8 +832,8 @@ void infoHeader();
void infoWriting(const char *what, upx_int64_t size); void infoWriting(const char *what, upx_int64_t size);
// work.cpp // work.cpp
void do_one_file(const char *iname, char *oname) may_throw; noinline void do_one_file(const char *iname, char *oname) may_throw;
int do_files(int i, int argc, char *argv[]) may_throw; noinline int do_files(int i, int argc, char *argv[]) may_throw;
// help.cpp // help.cpp
extern const char gitrev[]; extern const char gitrev[];
+3 -3
View File
@@ -49,7 +49,7 @@ const char gitrev[] = UPX_VERSION_GITREV;
const char gitrev[1] = {0}; const char gitrev[1] = {0};
#endif #endif
void show_header(void) { void show_header() {
FILE *f = con_term; FILE *f = con_term;
int fg; int fg;
@@ -85,7 +85,7 @@ void show_header(void) {
// usage // usage
**************************************************************************/ **************************************************************************/
void show_usage(void) { void show_usage() {
FILE *f = con_term; FILE *f = con_term;
con_fprintf(f, "Usage: %s [-123456789dlthVL] [-qvfk] [-o file] %sfile..\n", progname, con_fprintf(f, "Usage: %s [-123456789dlthVL] [-qvfk] [-o file] %sfile..\n", progname,
@@ -381,7 +381,7 @@ void show_help(int verbose) {
// license // license
**************************************************************************/ **************************************************************************/
void show_license(void) { void show_license() {
FILE *f = con_term; FILE *f = con_term;
show_header(); show_header();
+2 -1
View File
@@ -367,6 +367,8 @@ int ElfLinker::addLoader(const char *sname) {
return outputlen; return outputlen;
char *begin = strdup(sname); char *begin = strdup(sname);
assert(begin != nullptr);
const auto begin_deleter = upx::MallocDeleter(&begin, 1); // don't leak memory
char *end = begin + strlen(begin); char *end = begin + strlen(begin);
for (char *sect = begin; sect < end;) { for (char *sect = begin; sect < end;) {
for (char *tokend = sect; *tokend; tokend++) for (char *tokend = sect; *tokend; tokend++)
@@ -418,7 +420,6 @@ int ElfLinker::addLoader(const char *sname) {
} }
sect += strlen(sect) + 1; sect += strlen(sect) + 1;
} }
::free(begin);
return outputlen; return outputlen;
} }
+1 -1
View File
@@ -35,7 +35,7 @@ class ElfLinker /*not_final*/ : private upx::noncopyable {
friend class Packer; friend class Packer;
public: public:
const N_BELE_RTP::AbstractPolicy *const bele; // target endianness const N_BELE_RTP::AbstractPolicy *const bele; // TE - Target Endianness
protected: protected:
struct Section; struct Section;
struct Symbol; struct Symbol;
+4 -7
View File
@@ -67,12 +67,9 @@ static void handle_opterr(acc_getopt_p g, const char *f, void *v) {
static int exit_code = EXIT_OK; static int exit_code = EXIT_OK;
#if (WITH_GUI) #if (WITH_GUI)
static noinline void do_exit(void) { throw exit_code; } static noreturn void do_exit() { throw exit_code; }
#else #else
#if defined(__GNUC__) static noreturn void do_exit() {
static void do_exit(void) __attribute__((__noreturn__));
#endif
static void do_exit(void) {
static bool in_exit = false; static bool in_exit = false;
if (in_exit) if (in_exit)
@@ -115,7 +112,7 @@ static noinline void e_exit(int ec) {
do_exit(); do_exit();
} }
static noinline void e_usage(void) { static noinline void e_usage() {
if (opt->debug.getopt_throw_instead_of_exit) if (opt->debug.getopt_throw_instead_of_exit)
throw EXIT_USAGE; throw EXIT_USAGE;
show_usage(); show_usage();
@@ -217,7 +214,7 @@ static void check_and_update_options(int i, int argc) {
// misc // misc
**************************************************************************/ **************************************************************************/
static void e_help(void) { static void e_help() {
show_help(0); show_help(0);
e_exit(EXIT_USAGE); e_exit(EXIT_USAGE);
} }
+3 -1
View File
@@ -108,7 +108,8 @@ class Dummy {
/* Register usage information. */ // /* Register usage information. */ //
// PT_MIPS_RTPROC = 0x70000001, /* Runtime procedure table. */ // PT_MIPS_RTPROC = 0x70000001, /* Runtime procedure table. */
// PT_MIPS_OPTIONS = 0x70000002, // PT_MIPS_OPTIONS = 0x70000002,
PT_MIPS_ABIFLAGS = 0x70000003, /* FP mode requirement. */ PT_ARM_EXIDX = (0x70000000 + 1), /* ARM unwind segment. */
PT_MIPS_ABIFLAGS = 0x70000003, /* FP mode requirement. */
}; };
enum { // p_flags enum { // p_flags
@@ -148,6 +149,7 @@ class Dummy {
SHT_LOOS = 0x60000000, /* LOcal OS; SHT_ANDROID_REL{,A} is +1, +2 */ SHT_LOOS = 0x60000000, /* LOcal OS; SHT_ANDROID_REL{,A} is +1, +2 */
SHT_LOPROC = 0x70000000, /* Start of processor-specific */ SHT_LOPROC = 0x70000000, /* Start of processor-specific */
SHT_ARM_EXIDX = (SHT_LOPROC + 1), /* ARM unwind section. */
SHT_ARM_ATTRIBUTES = (SHT_LOPROC + 3), /* ARM attributes section. */ SHT_ARM_ATTRIBUTES = (SHT_LOPROC + 3), /* ARM attributes section. */
}; };
+72 -57
View File
@@ -487,17 +487,17 @@ PackLinuxElf32::slide_sh_offset(Elf32_Shdr *shdr)
{ {
unsigned sh_offset = get_te32(&shdr->sh_offset); unsigned sh_offset = get_te32(&shdr->sh_offset);
unsigned sh_addr = get_te32(&shdr->sh_addr); unsigned sh_addr = get_te32(&shdr->sh_addr);
char const *sh_name = get_te32(&shdr->sh_name) + shstrtab;
(void)sh_name; // convenience for debug
if (Elf32_Shdr::SHF_WRITE & get_te32(&shdr->sh_flags) if (Elf32_Shdr::SHF_WRITE & get_te32(&shdr->sh_flags)
|| (sh_offset && !sh_addr)) || (sh_offset && !sh_addr))
{ {
unsigned newoff = so_slide + sh_offset + (is_asl ? asl_delta : 0); unsigned newoff = so_slide + sh_offset + (is_asl ? asl_delta : 0);
if ((unsigned)this->file_size < newoff) { if (sh_addr // only check "real memory"
&& (unsigned)this->file_size < newoff) {
throwInternalError("bad slide %p %#x", shdr, (unsigned)so_slide); throwInternalError("bad slide %p %#x", shdr, (unsigned)so_slide);
} }
set_te32(&shdr->sh_offset, newoff); set_te32(&shdr->sh_offset, newoff);
if (sh_addr) // change only if non-zero
set_te32(&shdr->sh_addr,
so_slide + sh_addr + (is_asl ? asl_delta : 0));
return newoff; return newoff;
} }
return sh_offset; return sh_offset;
@@ -520,17 +520,17 @@ PackLinuxElf64::slide_sh_offset(Elf64_Shdr *shdr)
{ {
unsigned sh_offset = get_te64(&shdr->sh_offset); unsigned sh_offset = get_te64(&shdr->sh_offset);
unsigned sh_addr = get_te64(&shdr->sh_addr); unsigned sh_addr = get_te64(&shdr->sh_addr);
char const *sh_name = get_te32(&shdr->sh_name) + shstrtab;
(void)sh_name; // convenience for debug
if (Elf64_Shdr::SHF_WRITE & get_te64(&shdr->sh_flags) if (Elf64_Shdr::SHF_WRITE & get_te64(&shdr->sh_flags)
|| (sh_offset && !sh_addr)) || (sh_offset && !sh_addr))
{ {
unsigned newoff = so_slide + sh_offset + (is_asl ? asl_delta : 0); unsigned newoff = so_slide + sh_offset + (is_asl ? asl_delta : 0);
if ((unsigned)this->file_size < newoff) { if (sh_addr // only check "real memory"
&& (unsigned)this->file_size < newoff) {
throwInternalError("bad slide %p %#x", shdr, (unsigned)so_slide); throwInternalError("bad slide %p %#x", shdr, (unsigned)so_slide);
} }
set_te64(&shdr->sh_offset, newoff); set_te64(&shdr->sh_offset, newoff);
if (sh_addr) // change only if non-zero
set_te64(&shdr->sh_addr,
so_slide + sh_addr + (is_asl ? asl_delta : 0));
return newoff; return newoff;
} }
return sh_offset; return sh_offset;
@@ -641,25 +641,18 @@ off_t PackLinuxElf32::pack3(OutputFile *fo, Filter &ft)
Elf32_Phdr *const phdr0 = (Elf32_Phdr *)lowmem.subref( Elf32_Phdr *const phdr0 = (Elf32_Phdr *)lowmem.subref(
"bad e_phoff", e_phoff, e_phnum * sizeof(Elf32_Phdr)); "bad e_phoff", e_phoff, e_phnum * sizeof(Elf32_Phdr));
Elf32_Phdr *phdr = phdr0; Elf32_Phdr *phdr = phdr0, *outp = phdr0;
upx_off_t off = fo->st_size(); // 64 bits upx_off_t off = fo->st_size(); // 64 bits
so_slide = 0; so_slide = 0;
for (unsigned j = 0; j < e_phnum; ++j, ++phdr) { for (unsigned j = 0; j < e_phnum; ++j, ++phdr) {
// p_vaddr and p_paddr do not change! // p_vaddr and p_paddr do not change!
unsigned const len = get_te32(&phdr->p_filesz);
unsigned const ioff = get_te32(&phdri[j].p_offset); // without asl_delta unsigned const ioff = get_te32(&phdri[j].p_offset); // without asl_delta
unsigned align= get_te32(&phdr->p_align); unsigned align= get_te32(&phdr->p_align);
unsigned const type = get_te32(&phdr->p_type); unsigned const type = get_te32(&phdr->p_type);
if (Elf32_Phdr::PT_INTERP==type) { unsigned const len = get_te32(&phdr->p_filesz);
// Rotate to highest position, so it can be lopped if (Elf32_Phdr::PT_INTERP==type
// by decrementing e_phnum. || Elf32_Phdr::PT_ARM_EXIDX==type) {
memcpy((unsigned char *)ibuf, phdr, sizeof(*phdr)); // extract /* OMIT */ continue; // OMIT: reference to compressed data
memmove(phdr, 1+phdr, (e_phnum - (1+ j))*sizeof(*phdr)); // overlapping
memcpy(&phdr[e_phnum - (1+ j)], (unsigned char *)ibuf, sizeof(*phdr)); // to top
--phdr; --e_phnum;
set_te16(&ehdri.e_phnum, e_phnum);
set_te16(&((Elf32_Ehdr *)(unsigned char *)lowmem)->e_phnum, e_phnum);
continue;
} }
if (PT_LOAD == type) { if (PT_LOAD == type) {
if (!ioff) { // first PT_LOAD must contain everything written so far if (!ioff) { // first PT_LOAD must contain everything written so far
@@ -707,12 +700,21 @@ off_t PackLinuxElf32::pack3(OutputFile *fo, Filter &ft)
fo->seek(0, SEEK_END); fo->seek(0, SEEK_END);
} }
} }
continue; // all done with this PT_LOAD
} }
if (xct_off < ioff) { else if (Elf32_Phdr::PT_DYNAMIC == type
set_te32(&phdr->p_offset, so_slide + (is_asl ? asl_delta : 0) + ioff); || Elf32_Phdr::PT_GNU_RELRO == type) {
unsigned delta = so_slide + (is_asl ? asl_delta : 0);
set_te32(&phdr->p_offset, delta + ioff);
// unsigned x = get_te32(&phdr->p_vaddr);
// set_te32(&phdr->p_vaddr, delta + x);
// unsigned y = get_te32(&phdr->p_paddr);
// set_te32(&phdr->p_paddr, delta + y);
} }
*outp++ = *phdr; // propagate
} // end each Phdr } // end each Phdr
e_phnum = outp - phdr0;
set_te16(&ehdri.e_phnum, e_phnum);
set_te16(&((Elf32_Ehdr *)(unsigned char *)lowmem)->e_phnum, e_phnum);
if (sec_arm_attr || is_asl) { // must update Shdr.sh_offset for so_slide if (sec_arm_attr || is_asl) { // must update Shdr.sh_offset for so_slide
Elf32_Shdr *shdr = shdri; Elf32_Shdr *shdr = shdri;
@@ -769,6 +771,7 @@ off_t PackLinuxElf32::pack3(OutputFile *fo, Filter &ft)
return total_out; return total_out;
} }
// NYI 2025-12-10: should be updated from the Elf32::pack3 version
off_t PackLinuxElf64::pack3(OutputFile *fo, Filter &ft) off_t PackLinuxElf64::pack3(OutputFile *fo, Filter &ft)
{ {
if (!overlay_offset) { if (!overlay_offset) {
@@ -835,7 +838,7 @@ off_t PackLinuxElf64::pack3(OutputFile *fo, Filter &ft)
Elf64_Phdr *const phdr0 = (Elf64_Phdr *)lowmem.subref( Elf64_Phdr *const phdr0 = (Elf64_Phdr *)lowmem.subref(
"bad e_phoff", e_phoff, e_phnum * sizeof(Elf64_Phdr)); "bad e_phoff", e_phoff, e_phnum * sizeof(Elf64_Phdr));
Elf64_Phdr *phdr = phdr0; Elf64_Phdr *phdr = phdr0, *outp = phdr0;
upx_off_t off = fo->st_size(); // 64 bits upx_off_t off = fo->st_size(); // 64 bits
so_slide = 0; so_slide = 0;
for (unsigned j = 0; j < e_phnum; ++j, ++phdr) { for (unsigned j = 0; j < e_phnum; ++j, ++phdr) {
@@ -845,16 +848,9 @@ off_t PackLinuxElf64::pack3(OutputFile *fo, Filter &ft)
u64_t align= get_te64(&phdr->p_align); u64_t align= get_te64(&phdr->p_align);
unsigned const type = get_te32(&phdr->p_type); unsigned const type = get_te32(&phdr->p_type);
if (Elf64_Phdr::PT_INTERP==type) { if (Elf64_Phdr::PT_INTERP==type) {
// Rotate to highest position, so it can be lopped continue; // OMIT
// by decrementing e_phnum.
memcpy((unsigned char *)ibuf, phdr, sizeof(*phdr)); // extract
memmove(phdr, 1+phdr, (e_phnum - (1+ j))*sizeof(*phdr)); // overlapping
memcpy(&phdr[e_phnum - (1+ j)], (unsigned char *)ibuf, sizeof(*phdr)); // to top
--phdr; --e_phnum;
set_te16(&ehdri.e_phnum, e_phnum);
set_te16(&((Elf64_Ehdr *)(unsigned char *)lowmem)->e_phnum, e_phnum);
continue;
} }
*outp++ = *phdr; // propagate
if (PT_LOAD == type) { if (PT_LOAD == type) {
if (!ioff) { // first PT_LOAD must contain everything written so far if (!ioff) { // first PT_LOAD must contain everything written so far
set_te64(&phdr->p_filesz, sz_pack2 + lsize); // is this correct? set_te64(&phdr->p_filesz, sz_pack2 + lsize); // is this correct?
@@ -903,6 +899,9 @@ off_t PackLinuxElf64::pack3(OutputFile *fo, Filter &ft)
set_te64(&phdr->p_offset, so_slide + (is_asl ? asl_delta : 0) + ioff); set_te64(&phdr->p_offset, so_slide + (is_asl ? asl_delta : 0) + ioff);
} }
} // end each Phdr } // end each Phdr
e_phnum = outp - phdr0;
set_te16(&ehdri.e_phnum, e_phnum);
set_te16(&((Elf64_Ehdr *)(unsigned char *)lowmem)->e_phnum, e_phnum);
if (sec_arm_attr || is_asl) { // must update Shdr.sh_offset for so_slide if (sec_arm_attr || is_asl) { // must update Shdr.sh_offset for so_slide
// Update {DYNAMIC}.sh_offset by so_slide. // Update {DYNAMIC}.sh_offset by so_slide.
@@ -1704,6 +1703,8 @@ PackLinuxElf32::buildLinuxLoader(
relocateLoader(); relocateLoader();
} }
unsigned bb1; // aid for possible debugging NRV/UCL
void void
PackLinuxElf64::buildLinuxLoader( PackLinuxElf64::buildLinuxLoader(
upx_byte const *const proto, upx_byte const *const proto,
@@ -6105,6 +6106,8 @@ unsigned PackLinuxElf32::forward_Shdrs(OutputFile *fo, Elf32_Ehdr *const eho)
// Keep _Shdr for SHF_WRITE. // Keep _Shdr for SHF_WRITE.
// Discard _Shdr with (0==sh_addr), except _Shdr[0] // Discard _Shdr with (0==sh_addr), except _Shdr[0]
// Keep ARM_ATTRIBUTES // Keep ARM_ATTRIBUTES
// Remove .ARM.extab(PROGBITS) and .ARM.exidx(SHT_ARM_EXIDX)
// because they refer to compressed .text(PT_LOAD)
unsigned const want_types_mask = 0 unsigned const want_types_mask = 0
| 1u<<SHT_PROGBITS // see comment above, and special code below | 1u<<SHT_PROGBITS // see comment above, and special code below
| 1u<<SHT_HASH | 1u<<SHT_HASH
@@ -6179,30 +6182,14 @@ unsigned PackLinuxElf32::forward_Shdrs(OutputFile *fo, Elf32_Ehdr *const eho)
|| (Elf32_Shdr::SHT_ARM_ATTRIBUTES == sh_type) || (Elf32_Shdr::SHT_ARM_ATTRIBUTES == sh_type)
) { ) {
*sh_out = *sh_in; // *sh_in is a candidate for fowarding *sh_out = *sh_in; // *sh_in is a candidate for fowarding
if (sh_offset > xct_off) { // may slide down: earlier compression
if (sh_offset >= xct_off_hi) { // easy: so_slide down
if (Elf32_Shdr::SHT_ARM_ATTRIBUTES != sh_type) {
slide_sh_offset(sh_out);
}
}
else { // somewhere in compressed; try proportional (aligned)
// But note that PROGBITS without SHF_ALLOC
// will be dropped below.
u32_t const slice = xct_off + (~0xFu & (unsigned)(
(sh_offset - xct_off) *
((sh_offset - xct_off) / (float)(xct_off_hi - xct_off))));
//set_te32(&sh_out->sh_addr, slice);
set_te32(&sh_out->sh_offset, slice);
}
u32_t const max_sz = total_out - get_te32(&sh_out->sh_offset);
if (sh_size > max_sz) { // avoid complaint "extends beyond EOF"
set_te32(&sh_out->sh_size, max_sz);
}
}
if (j == e_shstrndx) { // changes Elf32_Ehdr itself if (j == e_shstrndx) { // changes Elf32_Ehdr itself
set_te16(&eho->e_shstrndx, sh_out - set_te16(&eho->e_shstrndx, sh_out -
(Elf32_Shdr *)mb_shdro.getVoidPtr()); (Elf32_Shdr *)mb_shdro.getVoidPtr());
} }
if (Elf32_Shdr::SHT_ARM_EXIDX == sh_type
|| 0==strcmp(".ARM.extab", name)) {
/* OMIT */ continue; // OMIT: compressed contents
}
if (Elf32_Shdr::SHT_ARM_ATTRIBUTES == sh_type if (Elf32_Shdr::SHT_ARM_ATTRIBUTES == sh_type
|| (SHT_NOTE == sh_type && xct_off < sh_offset) || (SHT_NOTE == sh_type && xct_off < sh_offset)
) { // append a copy ) { // append a copy
@@ -6216,7 +6203,7 @@ unsigned PackLinuxElf32::forward_Shdrs(OutputFile *fo, Elf32_Ehdr *const eho)
if (!(Elf32_Shdr::SHF_ALLOC & sh_flags)) { if (!(Elf32_Shdr::SHF_ALLOC & sh_flags)) {
// .debug_*, .gnu_debuglink etc. Typically compressed // .debug_*, .gnu_debuglink etc. Typically compressed
// but not in RAM, and gdb (BFD) gets confused. // but not in RAM, and gdb (BFD) gets confused.
continue; // OMIT the commit: do not forward /* OMIT */ continue; // OMIT the commit: do not forward
} else } else
if (sh_offset <= xct_off if (sh_offset <= xct_off
&& 0 == strcmp(".text", name) ) { && 0 == strcmp(".text", name) ) {
@@ -6231,9 +6218,31 @@ unsigned PackLinuxElf32::forward_Shdrs(OutputFile *fo, Elf32_Ehdr *const eho)
n_shstrsec = sh_out; n_shstrsec = sh_out;
} else } else
if (strcmp(".dynstr", name)) { if (strcmp(".dynstr", name)) {
continue; // OMIT the commit of non-global symbol names /* OMIT */ continue; // OMIT the commit of non-global symbol names
} }
} }
if (sh_offset > xct_off) { // may slide down: earlier compression
if (sh_offset >= xct_off_hi) { // easy: so_slide down
if (Elf32_Shdr::SHT_ARM_ATTRIBUTES != sh_type
// && Elf32_Shdr::SHT_ARM_EXIDX != sh_type
) {
slide_sh_offset(sh_out);
}
}
else { // somewhere in compressed; try proportional (aligned)
// Note that PROGBITS without SHF_ALLOC is already omitted.
u32_t const slice = xct_off + (~0xFu & (unsigned)(
(sh_offset - xct_off) *
((sh_offset - xct_off) / (float)(xct_off_hi - xct_off))));
//set_te32(&sh_out->sh_addr, slice);
set_te32(&sh_out->sh_offset, slice);
}
u32_t const max_sz = total_out - get_te32(&sh_out->sh_offset);
if (sh_size > max_sz) { // avoid complaint "extends beyond EOF"
set_te32(&sh_out->sh_size, max_sz);
}
}
// Will be forwarded, but needs a name.
set_te32(&sh_out->sh_name, ptr_shstrings - (char *)mb_shstrings.getVoidPtr()); set_te32(&sh_out->sh_name, ptr_shstrings - (char *)mb_shstrings.getVoidPtr());
do { // stupid MSVC lacks stpcpy() do { // stupid MSVC lacks stpcpy()
*ptr_shstrings++ = *name; *ptr_shstrings++ = *name;
@@ -6279,6 +6288,7 @@ unsigned PackLinuxElf32::forward_Shdrs(OutputFile *fo, Elf32_Ehdr *const eho)
} }
} }
} }
UNUSED(ptr);
fo->seek(0, SEEK_SET); fo->seek(0, SEEK_SET);
fo->rewrite(eho, sizeof(*eho)); fo->rewrite(eho, sizeof(*eho));
@@ -6289,6 +6299,7 @@ unsigned PackLinuxElf32::forward_Shdrs(OutputFile *fo, Elf32_Ehdr *const eho)
return penalty; return penalty;
} }
// NYI 2025-12-10: should be merged from Elf32::forward_Shdrs
unsigned PackLinuxElf64::forward_Shdrs(OutputFile *fo, Elf64_Ehdr *const eho) unsigned PackLinuxElf64::forward_Shdrs(OutputFile *fo, Elf64_Ehdr *const eho)
{ {
if (!fo) { if (!fo) {
@@ -6300,7 +6311,9 @@ unsigned PackLinuxElf64::forward_Shdrs(OutputFile *fo, Elf64_Ehdr *const eho)
// Keep _Shdr for rtld data (below xct_off). // Keep _Shdr for rtld data (below xct_off).
// Discard _Shdr for compressed regions, except ".text" for gdb. // Discard _Shdr for compressed regions, except ".text" for gdb.
// Keep _Shdr with SHF_WRITE. // Keep _Shdr with SHF_WRITE.
// Keep ARM_ATTRIBUTES // Keep ARM_ATTRIBUTES.
// Remove .ARM.extab(PROGBITS) and .ARM.exidx(ARM_EXIDX)
// because they refer to compressed .text.
// Discard _Shdr with (0==sh_addr), except _Shdr[0] // Discard _Shdr with (0==sh_addr), except _Shdr[0]
unsigned const want_types_mask = unsigned const want_types_mask =
1u<<SHT_SYMTAB 1u<<SHT_SYMTAB
@@ -6348,7 +6361,6 @@ unsigned PackLinuxElf64::forward_Shdrs(OutputFile *fo, Elf64_Ehdr *const eho)
for (unsigned j = 1; j < e_shnum; ++j, ++sh_in) { for (unsigned j = 1; j < e_shnum; ++j, ++sh_in) {
char const *sh_name = &shstrtab[get_te32(&sh_in->sh_name)]; char const *sh_name = &shstrtab[get_te32(&sh_in->sh_name)];
(void)sh_name; // debugging
unsigned sh_type = get_te32(&sh_in->sh_type); unsigned sh_type = get_te32(&sh_in->sh_type);
u64_t sh_flags = get_te64(&sh_in->sh_flags); u64_t sh_flags = get_te64(&sh_in->sh_flags);
u64_t sh_addr = get_te64(&sh_in->sh_addr); u64_t sh_addr = get_te64(&sh_in->sh_addr);
@@ -6393,6 +6405,9 @@ unsigned PackLinuxElf64::forward_Shdrs(OutputFile *fo, Elf64_Ehdr *const eho)
set_te16(&eho->e_shstrndx, sh_out - set_te16(&eho->e_shstrndx, sh_out -
(Elf64_Shdr *)mb_shdro.getVoidPtr()); (Elf64_Shdr *)mb_shdro.getVoidPtr());
} }
if (0==strcmp(".ARM.extab", sh_name)) {
/* OMIT */ continue; // OMIT: compressed contents
}
if (j == e_shstrndx if (j == e_shstrndx
|| sec_arm_attr == sh_in || sec_arm_attr == sh_in
|| (SHT_NOTE == sh_type && xct_off < sh_offset) || (SHT_NOTE == sh_type && xct_off < sh_offset)
+5 -1
View File
@@ -658,7 +658,11 @@ void PackUnix::unpack(OutputFile *fo)
fi->readx(&bhdr, szb_info); fi->readx(&bhdr, szb_info);
ph.u_len = sz_unc = get_te32(&bhdr.sz_unc); ph.u_len = sz_unc = get_te32(&bhdr.sz_unc);
ph.c_len = sz_cpr = get_te32(&bhdr.sz_cpr); ph.c_len = sz_cpr = get_te32(&bhdr.sz_cpr);
ph.set_method(bhdr.b_method); if (szb_info < sizeof(b_info)) { // some upx version 11
bhdr.b_method = ph.method;
bhdr.b_ftid = ph.filter;
bhdr.b_cto8 = ph.filter_cto;
}
if (sz_unc == 0) // uncompressed size 0 -> EOF if (sz_unc == 0) // uncompressed size 0 -> EOF
{ {
+6 -6
View File
@@ -857,9 +857,9 @@ void Packer::relocateLoader() {
} }
/************************************************************************* /*************************************************************************
// void Packer::compressWithFilters(): // void Packer::compressWithFilters():
// Try compression with several methods and filters, choose the best // Try compression with several methods and filters, choose the best
/ or first working one. Needs buildLoader(). // or first working one. Needs buildLoader().
// //
// Required inputs: // Required inputs:
// this->ph // this->ph
@@ -1015,9 +1015,9 @@ void Packer::compressWithFilters(byte *i_ptr,
byte *const hdr_ptr, const unsigned hdr_len, byte *const hdr_ptr, const unsigned hdr_len,
Filter *const parm_ft, // updated Filter *const parm_ft, // updated
const unsigned overlap_range, const unsigned overlap_range,
upx_compress_config_t const *const cconf, const upx_compress_config_t *const cconf,
int filter_strategy, // in+out for prepareFilters int filter_strategy, // in+out for prepareFilters
bool const inhibit_compression_check) { const bool inhibit_compression_check) {
parm_ft->buf_len = f_len; parm_ft->buf_len = f_len;
// struct copies // struct copies
const PackHeader orig_ph = this->ph; const PackHeader orig_ph = this->ph;
@@ -1219,7 +1219,7 @@ void Packer::compressWithFilters(Filter *ft, const unsigned overlap_range,
} }
void Packer::compressWithFilters(Filter *ft, const unsigned overlap_range, void Packer::compressWithFilters(Filter *ft, const unsigned overlap_range,
upx_compress_config_t const *cconf, int filter_strategy, const upx_compress_config_t *cconf, int filter_strategy,
unsigned filter_off, unsigned ibuf_off, unsigned obuf_off, unsigned filter_off, unsigned ibuf_off, unsigned obuf_off,
byte *const hdr_ptr, unsigned hdr_len, byte *const hdr_ptr, unsigned hdr_len,
bool inhibit_compression_check) { bool inhibit_compression_check) {
+8 -8
View File
@@ -162,7 +162,7 @@ protected:
unsigned f_len, // subset of [*i_ptr, +i_len) unsigned f_len, // subset of [*i_ptr, +i_len)
byte *const hdr_ptr, unsigned hdr_len, byte *const hdr_ptr, unsigned hdr_len,
Filter *parm_ft, // updated Filter *parm_ft, // updated
unsigned overlap_range, upx_compress_config_t const *cconf, unsigned overlap_range, const upx_compress_config_t *cconf,
int filter_strategy, bool inhibit_compression_check = false); int filter_strategy, bool inhibit_compression_check = false);
// util for verifying overlapping decompression // util for verifying overlapping decompression
@@ -248,7 +248,7 @@ protected:
int patch_le32(void *b, int blen, const void *old, unsigned new_); int patch_le32(void *b, int blen, const void *old, unsigned new_);
void checkPatch(void *b, int blen, int boff, int size); void checkPatch(void *b, int blen, int boff, int size);
// relocation util // relocation util [see packer_r.cpp]
static unsigned optimizeReloc(unsigned relocnum, SPAN_P(byte) relocs, SPAN_S(byte) out, static unsigned optimizeReloc(unsigned relocnum, SPAN_P(byte) relocs, SPAN_S(byte) out,
SPAN_P(byte) image, unsigned image_size, int bits, bool bswap, SPAN_P(byte) image, unsigned image_size, int bits, bool bswap,
int *big); int *big);
@@ -260,7 +260,7 @@ protected:
// permissive version using "void *" // permissive version using "void *"
inline unsigned get_te16(const void *p) const noexcept { return bele->get16(p); } inline unsigned get_te16(const void *p) const noexcept { return bele->get16(p); }
inline unsigned get_te32(const void *p) const noexcept { return bele->get32(p); } inline unsigned get_te32(const void *p) const noexcept { return bele->get32(p); }
inline unsigned get_te64_32(const void *p) const { return (unsigned) bele->get64(p); } inline unsigned get_te64_32(const void *p) const may_throw { return (unsigned) bele->get64(p); }
inline upx_uint64_t get_te64(const void *p) const noexcept { return bele->get64(p); } inline upx_uint64_t get_te64(const void *p) const noexcept { return bele->get64(p); }
inline void set_te16(void *p, unsigned v) noexcept { bele->set16(p, v); } inline void set_te16(void *p, unsigned v) noexcept { bele->set16(p, v); }
inline void set_te32(void *p, unsigned v) noexcept { bele->set32(p, v); } inline void set_te32(void *p, unsigned v) noexcept { bele->set32(p, v); }
@@ -293,11 +293,11 @@ protected:
return bele->get32(p); return bele->get32(p);
} }
template <class T, class = enable_if_te64<T> > template <class T, class = enable_if_te64<T> >
inline unsigned get_te64_32(const T *p) const { inline unsigned get_te64_32(const T *p) const may_throw {
upx_uint64_t val = get_te64(p); upx_uint64_t v = bele->get64(p);
if (val >> 32) if ((v >> 32) != 0)
throwCantPack("64-bit value too big %#llx", val); throwCantPack("64-bit value too big %#llx", v);
return (unsigned) val; return (unsigned) v;
} }
template <class T, class = enable_if_te64<T> > template <class T, class = enable_if_te64<T> >
inline upx_uint64_t get_te64(const T *p) const noexcept { inline upx_uint64_t get_te64(const T *p) const noexcept {
+3 -3
View File
@@ -39,12 +39,13 @@ struct PackHeader final {
~PackHeader() noexcept = default; ~PackHeader() noexcept = default;
void reset() noexcept; void reset() noexcept;
int set_method(int m, unsigned offset = 0); // check, then assign
int getPackHeaderSize() const;
void putPackHeader(SPAN_S(byte) p) const; void putPackHeader(SPAN_S(byte) p) const;
bool decodePackHeaderFromBuf(SPAN_S(const byte) b, int blen); bool decodePackHeaderFromBuf(SPAN_S(const byte) b, int blen);
int getPackHeaderSize() const;
// fields stored in compressed file => see stub/src/include/header.S // fields stored in compressed file => see stub/src/include/header.S
// enum { magic = UPX_MAGIC_LE32 }; // enum { magic = UPX_MAGIC_LE32 };
int version; int version;
@@ -63,7 +64,6 @@ struct PackHeader final {
int n_mru; // specific name for filter ctojr int n_mru; // specific name for filter ctojr
}; };
int header_checksum; int header_checksum;
int set_method(int m, unsigned offset = 0); // check, then assign
// support fields for verifying decompression // support fields for verifying decompression
unsigned saved_u_adler; unsigned saved_u_adler;
+64 -30
View File
@@ -96,6 +96,7 @@ PeFile::PeFile(InputFile *f) : super(f) {
use_tls_callbacks = false; use_tls_callbacks = false;
oloadconf = nullptr; oloadconf = nullptr;
soloadconf = 0; soloadconf = 0;
dbgCET = nullptr;
isdll = false; isdll = false;
isrtm = false; isrtm = false;
@@ -1479,30 +1480,39 @@ void PeFile::processTls2(Reloc *const rel, const Interval *const iv, unsigned ne
if (sotls == 0) if (sotls == 0)
return; return;
// add new relocation entries
// add new relocation entries
if (tls_handler_offset > 0 && tls_handler_offset_reloc > 0) if (tls_handler_offset > 0 && tls_handler_offset_reloc > 0)
rel->add_reloc(tls_handler_offset + tls_handler_offset_reloc, reloc_type); rel->add_reloc(tls_handler_offset + tls_handler_offset_reloc, reloc_type);
unsigned ic;
// NEW: if TLS callbacks are used, relocate the VA of the callback chain, too - Stefan Widmann // NEW: if TLS callbacks are used, relocate the VA of the callback chain, too - Stefan Widmann
for (ic = 0; ic < (use_tls_callbacks ? sizeof(LE32) * cb_size : (sizeof(LE32) - 1) * cb_size); for (unsigned ic = 0; ic < (unsigned) (use_tls_callbacks ? 4 : 3); ic++)
ic += cb_size) rel->add_reloc(newaddr + ic * cb_size, reloc_type);
rel->add_reloc(newaddr + ic, reloc_type);
SPAN_S_VAR(tls, const tlsp, mb_otls); SPAN_S_VAR(tls, const tlsp, mb_otls);
// now the relocation entries in the tls data area // now the relocation entries in the tls data area
for (ic = 0; ic < iv->ivnum; ic += sizeof(LE32)) { for (unsigned ic = 0; ic < iv->ivnum; ic++) {
SPAN_S_VAR(byte, const pp, SPAN_S_VAR(byte, const pp,
otls + (iv->ivarr[ic].start - (tlsp->datastart - imagebase) + sizeof(tls))); otls + (iv->ivarr[ic].start - (tlsp->datastart - imagebase) + sizeof(tls)));
LEXX *const p = (LEXX *) raw_bytes(pp, sizeof(LEXX)); LEXX *const p = (LEXX *) raw_bytes(pp, sizeof(LEXX));
cb_value_t kc = *p; cb_value_t kc = *p;
if (kc < tlsp->dataend && kc >= tlsp->datastart) { if (kc >= tlsp->datastart && kc < tlsp->dataend) {
// add a relocation entry referring to an address inside of the original tls data area
// - as the new tls area is moved, the referred address have to be also adjusted
kc += newaddr + sizeof(tls) - tlsp->datastart; kc += newaddr + sizeof(tls) - tlsp->datastart;
*p = kc + imagebase; *p = kc + imagebase;
rel->add_reloc(kc, iv->ivarr[ic].len); rel->add_reloc(kc, iv->ivarr[ic].len);
} else } else {
rel->add_reloc(kc - imagebase, iv->ivarr[ic].len); // add a relocation entry referring to an address outside of the original tls data area
// by adding the difference of the new tlsdatastart and the old tlsdatastart to
// the address of the original relocation record
const unsigned a =
iv->ivarr[ic].start + (newaddr + sizeof(tls)) - (tlsp->datastart - imagebase);
// Must not overwrite compressed data
if (a < newaddr && !opt->win32_pe.strip_relocs)
throwCantPack("relocation too low (%#x < %#x); try --strip-relocs", a, newaddr);
rel->add_reloc(a, iv->ivarr[ic].len);
}
} }
const unsigned tls_data_size = tlsp->dataend - tlsp->datastart; const unsigned tls_data_size = tlsp->dataend - tlsp->datastart;
@@ -1726,15 +1736,15 @@ PeFile::Resource::upx_rnode *PeFile::Resource::convert(const void *rnode, upx_rn
branch->name = nullptr; branch->name = nullptr;
branch->parent = parent; branch->parent = parent;
branch->nc = ic; branch->nc = ic;
branch->children = New(upx_rnode *, ic); branch->children = New0(upx_rnode *, ic);
branch->data = *node; branch->data = *node;
if (!root) // first one if (!root) // first one
root = branch; // prevent leak if xcheck throws (hacked unpack or test) root = branch; // prevent leak if xcheck throws (hacked unpack or test)
for (const res_dir_entry *rde = node->entries + ic - 1; --ic >= 0; rde--) { for (const res_dir_entry *rde = node->entries + ic - 1; --ic >= 0; rde--) {
upx_rnode *child = convert(start + (rde->child & 0x7fffffff), branch, level + 1); upx_rnode *child = convert(start + (rde->child & 0x7fffffff), branch, level + 1);
xcheck(child);
branch->children[ic] = child; branch->children[ic] = child;
xcheck(child);
child->id = rde->tnl; child->id = rde->tnl;
if (child->id & 0x80000000) { if (child->id & 0x80000000) {
const byte *p = start + (child->id & 0x7fffffff); const byte *p = start + (child->id & 0x7fffffff);
@@ -2083,25 +2093,32 @@ unsigned PeFile::stripDebug(unsigned overlaystart) {
if (IDADDR(PEDIR_DEBUG) == 0) if (IDADDR(PEDIR_DEBUG) == 0)
return overlaystart; return overlaystart;
struct alignas(1) DebugDir final {
byte _[16]; // flags, time/date, version, type
LE32 size;
byte __[4]; // rva
LE32 fpos;
};
COMPILE_TIME_ASSERT(sizeof(DebugDir) == 28) COMPILE_TIME_ASSERT(sizeof(DebugDir) == 28)
COMPILE_TIME_ASSERT_ALIGNED1(DebugDir) COMPILE_TIME_ASSERT_ALIGNED1(DebugDir)
COMPILE_TIME_ASSERT(sizeof(((DebugDir *) nullptr)->_) == 16)
COMPILE_TIME_ASSERT(sizeof(((DebugDir *) nullptr)->__) == 4)
const unsigned skip = IDADDR(PEDIR_DEBUG); const unsigned skip = IDADDR(PEDIR_DEBUG);
const unsigned take = IDSIZE(PEDIR_DEBUG); const unsigned take = IDSIZE(PEDIR_DEBUG);
const DebugDir *dd = (const DebugDir *) ibuf.subref("bad debug %#x", skip, take); DebugDir *const dd0 = (DebugDir *) ibuf.subref("bad debug %#x", skip, take);
for (unsigned ic = 0; ic < IDSIZE(PEDIR_DEBUG) / sizeof(DebugDir); ic++, dd++) DebugDir *dd = dd0;
for (unsigned ic = 0; ic < IDSIZE(PEDIR_DEBUG) / sizeof(DebugDir); ic++, dd++) {
if (IMAGE_DEBUG_TYPE_EX_DLLCHARACTERISTICS == dd->type && dd->size == sizeof(LE32) &&
dd->fpos <= (file_size_u - sizeof(LE32))) {
// fpos need not belong to any PEDIR_* section.
// Read directly from input file, but keep position (paranoia).
LE32 word;
upx_off_t const now_pos = fi->tell();
fi->seek(dd->fpos, SEEK_SET);
fi->read(&word, sizeof(word));
fi->seek(now_pos, SEEK_SET);
if (IMAGE_DLLCHARACTERISTICS_EX_CET_COMPAT & word) {
*(dbgCET = dd0) = *dd; // remember presence; copy to front
}
}
if (overlaystart == dd->fpos) if (overlaystart == dd->fpos)
overlaystart += dd->size; overlaystart += dd->size;
ibuf.fill(IDADDR(PEDIR_DEBUG), IDSIZE(PEDIR_DEBUG), FILLVAL); }
ibuf.fill((!dbgCET ? 0 : sizeof(DebugDir)) + IDADDR(PEDIR_DEBUG),
(!dbgCET ? 0 : -(int) sizeof(DebugDir)) + IDSIZE(PEDIR_DEBUG), FILLVAL);
return overlaystart; return overlaystart;
} }
@@ -2488,8 +2505,8 @@ void PeFile::pack0(OutputFile *fo, ht &ih, ht &oh, unsigned subsystem_mask,
obuf.clear(ph.c_len, c_len - ph.c_len); obuf.clear(ph.c_len, c_len - ph.c_len);
const unsigned aligned_sotls = ALIGN_UP(sotls, usizeof(LEXX)); const unsigned aligned_sotls = ALIGN_UP(sotls, usizeof(LEXX));
const unsigned s1size = const unsigned s1size = ALIGN_UP(ic + c_len + codesize, usizeof(LEXX)) + aligned_sotls +
ALIGN_UP(ic + c_len + codesize, usizeof(LEXX)) + aligned_sotls + soloadconf; soloadconf + (dbgCET ? (sizeof(LE32) + sizeof(*dbgCET)) : 0);
const unsigned s1addr = (newvsize - (ic + c_len) + oam1) & ~oam1; const unsigned s1addr = (newvsize - (ic + c_len) + oam1) & ~oam1;
const unsigned ncsection = (s1addr + s1size + oam1) & ~oam1; const unsigned ncsection = (s1addr + s1size + oam1) & ~oam1;
@@ -2507,7 +2524,7 @@ void PeFile::pack0(OutputFile *fo, ht &ih, ht &oh, unsigned subsystem_mask,
oh.chksum = 0; oh.chksum = 0;
// fill the data directory // fill the data directory
ODADDR(PEDIR_DEBUG) = 0; ODADDR(PEDIR_DEBUG) = 0; // dbgCET later
ODSIZE(PEDIR_DEBUG) = 0; ODSIZE(PEDIR_DEBUG) = 0;
ODADDR(PEDIR_IAT) = 0; ODADDR(PEDIR_IAT) = 0;
ODSIZE(PEDIR_IAT) = 0; ODSIZE(PEDIR_IAT) = 0;
@@ -2515,7 +2532,8 @@ void PeFile::pack0(OutputFile *fo, ht &ih, ht &oh, unsigned subsystem_mask,
ODSIZE(PEDIR_BOUND_IMPORT) = 0; ODSIZE(PEDIR_BOUND_IMPORT) = 0;
// tls & loadconf are put into section 1 // tls & loadconf are put into section 1
ic = s1addr + s1size - aligned_sotls - soloadconf; ic = s1addr + s1size - aligned_sotls - soloadconf -
(dbgCET ? (sizeof(LE32) + sizeof(*dbgCET)) : 0);
if (use_tls_callbacks) if (use_tls_callbacks)
tls_handler_offset = linker->getSymbolOffset("PETLSC2") + upxsection; tls_handler_offset = linker->getSymbolOffset("PETLSC2") + upxsection;
@@ -2530,6 +2548,11 @@ void PeFile::pack0(OutputFile *fo, ht &ih, ht &oh, unsigned subsystem_mask,
ODSIZE(PEDIR_LOAD_CONFIG) = soloadconf; ODSIZE(PEDIR_LOAD_CONFIG) = soloadconf;
ic += soloadconf; ic += soloadconf;
if (dbgCET) {
ODADDR(PEDIR_DEBUG) = ic;
ODSIZE(PEDIR_DEBUG) = sizeof(*dbgCET);
ic += sizeof(LE32) + ODSIZE(PEDIR_DEBUG);
}
const bool rel_at_sections_start = last_section_rsrc_only; const bool rel_at_sections_start = last_section_rsrc_only;
ic = ncsection; ic = ncsection;
@@ -2675,6 +2698,19 @@ void PeFile::pack0(OutputFile *fo, ht &ih, ht &oh, unsigned subsystem_mask,
fo->write(ibuf, sizeof(LEXX) - ic); fo->write(ibuf, sizeof(LEXX) - ic);
fo->write(otls, aligned_sotls); fo->write(otls, aligned_sotls);
fo->write(oloadconf, soloadconf); fo->write(oloadconf, soloadconf);
if (dbgCET) {
ic = fo->getBytesWritten();
dbgCET->fpos = ic + sizeof(*dbgCET);
dbgCET->rva = rvamin + 0x400 + dbgCET->fpos; // 0x400 => soheaders
LE32 word;
set_le32(&word, IMAGE_DLLCHARACTERISTICS_EX_CET_COMPAT);
if (0) { // set all bytes t0 zero
memset(dbgCET, 0, sizeof(*dbgCET));
set_le32(&word, 0);
}
fo->write(dbgCET, sizeof(*dbgCET));
fo->write(&word, sizeof(word));
}
if ((ic = fo->getBytesWritten() & fam1) != 0) if ((ic = fo->getBytesWritten() & fam1) != 0)
fo->write(ibuf, oh.filealign - ic); fo->write(ibuf, oh.filealign - ic);
if (!last_section_rsrc_only) if (!last_section_rsrc_only)
@@ -2695,7 +2731,7 @@ void PeFile::pack0(OutputFile *fo, ht &ih, ht &oh, unsigned subsystem_mask,
fo->write(ibuf, oh.filealign - ic); fo->write(ibuf, oh.filealign - ic);
} }
#if 0 #if 0 // (debug) print section sizes
printf("%-13s: program hdr : %8d bytes\n", getName(), (int) sizeof(oh)); printf("%-13s: program hdr : %8d bytes\n", getName(), (int) sizeof(oh));
printf("%-13s: sections : %8d bytes\n", getName(), (int) sizeof(osection[0]) * oobjs); printf("%-13s: sections : %8d bytes\n", getName(), (int) sizeof(osection[0]) * oobjs);
printf("%-13s: ident : %8d bytes\n", getName(), (int) identsize); printf("%-13s: ident : %8d bytes\n", getName(), (int) identsize);
@@ -3030,8 +3066,6 @@ void PeFile::unpack0(OutputFile *fo, const ht &ih, ht &oh, ord_mask_t ord_mask,
// memset(eistart, 0, ptr_udiff_bytes(extra_info, eistart) + 4); // memset(eistart, 0, ptr_udiff_bytes(extra_info, eistart) + 4);
// fill the data directory // fill the data directory
ODADDR(PEDIR_DEBUG) = 0;
ODSIZE(PEDIR_DEBUG) = 0;
ODADDR(PEDIR_IAT) = 0; ODADDR(PEDIR_IAT) = 0;
ODSIZE(PEDIR_IAT) = 0; ODSIZE(PEDIR_IAT) = 0;
ODADDR(PEDIR_BOUND_IMPORT) = 0; ODADDR(PEDIR_BOUND_IMPORT) = 0;
+11
View File
@@ -519,6 +519,17 @@ protected:
void build(char *base, unsigned newoffs); void build(char *base, unsigned newoffs);
unsigned getsize() const { return size; } unsigned getsize() const { return size; }
}; };
struct alignas(1) DebugDir final {
LE32 flags, date_time, version;
LE32 type;
LE32 size;
LE32 rva;
LE32 fpos;
};
enum { IMAGE_DEBUG_TYPE_EX_DLLCHARACTERISTICS = 20 };
enum { IMAGE_DLLCHARACTERISTICS_EX_CET_COMPAT = 0x001 };
struct DebugDir *dbgCET = nullptr;
}; };
class PeFile32 : public PeFile { class PeFile32 : public PeFile {
+8 -7
View File
@@ -167,7 +167,7 @@ all: $$(all.targets)
@echo "timestamp" > $@ @echo "timestamp" > $@
.DELETE_ON_ERROR: .upx-stubtools-stamp .DELETE_ON_ERROR: .upx-stubtools-stamp
%/.tmp-stamp: %/.tmp-stamp:
@mkdir -p $(dir $@) @mkdir -p "$(dir $@)"
@echo "timestamp" > $@ @echo "timestamp" > $@
.PRECIOUS: %/.tmp-stamp .PRECIOUS: %/.tmp-stamp
.all-stamp: $$(STUBS) .all-stamp: $$(STUBS)
@@ -208,6 +208,7 @@ ECHO_e = /bin/echo -e
ECHO_E = /bin/echo -E ECHO_E = /bin/echo -E
PERL = perl PERL = perl
PYTHON2 = python2 PYTHON2 = python2
PYTHON3 = python3
UNIX2DOS := $(PERL) -i -pe 's/$$/\r/;' UNIX2DOS := $(PERL) -i -pe 's/$$/\r/;'
# trim (strip) trailing whitespace # trim (strip) trailing whitespace
@@ -240,15 +241,15 @@ define tc
endef endef
# default tools # default tools
tc.default.bin2h = $(PYTHON2) $(top_srcdir)/src/stub/scripts/bin2h.py --ident=auto-stub tc.default.bin2h = $(PYTHON3) "$(top_srcdir)/src/stub/scripts/bin2h.py" --ident=auto-stub
##tc.default.bin2h-c = $(call tc,bin2h) --compress=14,15,0 ##tc.default.bin2h-c = $(call tc,bin2h) --compress=14,15,0
tc.default.bin2h-c = $(call tc,bin2h) --compress=0 tc.default.bin2h-c = $(call tc,bin2h) --compress=0
tc.default.brandelf = $(PYTHON2) $(top_srcdir)/src/stub/scripts/brandelf.py $(if $(tc_bfdname),--bfdname=$(tc_bfdname)) tc.default.brandelf = $(PYTHON3) "$(top_srcdir)/src/stub/scripts/brandelf.py" $(if $(tc_bfdname),--bfdname=$(tc_bfdname))
tc.default.gpp_inc = $(PYTHON2) $(top_srcdir)/src/stub/scripts/gpp_inc.py tc.default.gpp_inc = $(PYTHON3) "$(top_srcdir)/src/stub/scripts/gpp_inc.py"
tc.default.gpp_mkdep = $(PYTHON2) $(top_srcdir)/src/stub/scripts/gpp_inc.py -o /dev/null tc.default.gpp_mkdep = $(PYTHON3) "$(top_srcdir)/src/stub/scripts/gpp_inc.py" -o /dev/null
tc.default.pp-as = i386-linux-gcc-3.4.6 -E -nostdinc -x assembler-with-cpp -Wall tc.default.pp-as = i386-linux-gcc-3.4.6 -E -nostdinc -x assembler-with-cpp -Wall
tc.default.sstrip = sstrip-20060518 tc.default.sstrip = sstrip-20060518
tc.default.xstrip = $(PYTHON2) $(top_srcdir)/src/stub/scripts/xstrip.py tc.default.xstrip = $(PYTHON3) "$(top_srcdir)/src/stub/scripts/xstrip.py"
# default multiarch-binutils # default multiarch-binutils
tc.default.m-ar = multiarch-ar-2.17 tc.default.m-ar = multiarch-ar-2.17
@@ -318,7 +319,7 @@ endef
define tc.default.f-embed_objinfo_without_xstrip_keep_dot_text define tc.default.f-embed_objinfo_without_xstrip_keep_dot_text
chmod a-x $1 chmod a-x $1
$(call tc,objcopy) -R .data -R .bss $1 $(call tc,objcopy) -R .data -R .bss $1
$(call tc,objcopy) -R .comment -R .note -R .note.GNU-stack -R .reginfo $1 $(call tc,objcopy) -R .comment -R .note -R .note.GNU-stack -R .reginfo $1
$(call tc,objcopy) --strip-unneeded --keep-symbol=_start --keep-symbol=upx_so_main $1 $(call tc,objcopy) --strip-unneeded --keep-symbol=_start --keep-symbol=upx_so_main $1
# #
+39 -36
View File
@@ -1,4 +1,4 @@
#! /usr/bin/env python2 #! /usr/bin/env python3
## vim:set ts=4 sw=4 et: -*- coding: utf-8 -*- ## vim:set ts=4 sw=4 et: -*- coding: utf-8 -*-
# #
# bin2h.py -- # bin2h.py --
@@ -45,7 +45,7 @@ class opts:
# ************************************************************************/ # ************************************************************************/
def w_header_c(w, ifile, ofile, n): def w_header_c(w, ifile, ofile, n):
w("/* %s\n created from %s, %d (0x%x) bytes\n" % (os.path.basename(ofile), os.path.basename(ifile), n, n)) w(("/* %s\n created from %s, %d (0x%x) bytes\n" % (os.path.basename(ofile), os.path.basename(ifile), n, n)).encode())
w("""\n\ w("""\n\
This file is part of the UPX executable compressor. This file is part of the UPX executable compressor.
@@ -74,7 +74,7 @@ def w_header_c(w, ifile, ofile, n):
John F. Reiser John F. Reiser
<jreiser@users.sourceforge.net> <jreiser@users.sourceforge.net>
*/\n\n""") */\n\n""".encode())
# /*********************************************************************** # /***********************************************************************
@@ -87,11 +87,11 @@ class DataWriter:
self.pos = None self.pos = None
def w_bol(self, pos): def w_bol(self, pos):
self.w("/* 0x%04x */ " % (pos)) self.w(("/* 0x%04x */ " % (pos)).encode())
self.pos = pos self.pos = pos
def w_eol(self, fill=""): def w_eol(self, fill=""):
if self.pos is not None: if self.pos is not None:
self.w(fill.rstrip() + "\n") self.w((fill.rstrip() + "\n").encode())
class DataWriter_c(DataWriter): class DataWriter_c(DataWriter):
@@ -101,8 +101,8 @@ class DataWriter_c(DataWriter):
if i & 15 == 0: if i & 15 == 0:
self.w_eol() self.w_eol()
self.w_bol(i) self.w_bol(i)
w("%3d" % ord(data[i])) w(("%3d" % data[i]).encode())
if i != n - 1: w(",") if i != n - 1: w(",".encode())
self.w_eol() self.w_eol()
@@ -113,10 +113,10 @@ class DataWriter_gas(DataWriter):
if i & 15 == 0: if i & 15 == 0:
self.w_eol() self.w_eol()
self.w_bol(i) self.w_bol(i)
w(".byte ") w(".byte ".encode())
else: else:
w(",") w(",".encode())
w("%3d" % ord(data[i])) w(("%3d" % data[i]).encode())
self.w_eol() self.w_eol()
@@ -128,12 +128,12 @@ class _DataWriter_gas_u32(DataWriter):
if i & 15 == 0: if i & 15 == 0:
self.w_eol() self.w_eol()
self.w_bol(i) self.w_bol(i)
w(".int ") w(".int ".encode())
else: else:
w(",") w(",".encode())
v = struct.unpack(self.DECODE, data[i:i+4]) v = struct.unpack(self.DECODE, data[i:i+4])
assert len(v) == 1, v assert len(v) == 1, v
w("0x%08x" % (v[0] & 0xffffffffL)) w(("0x%08x" % (v[0] & 0xffffffff)).encode())
self.w_eol() self.w_eol()
class DataWriter_gas_be32(_DataWriter_gas_u32): class DataWriter_gas_be32(_DataWriter_gas_u32):
@@ -148,7 +148,7 @@ class DataWriter_nasm(DataWriter):
def w_eol(self, fill=""): def w_eol(self, fill=""):
if self.pos is not None: if self.pos is not None:
self.w(fill) self.w(fill)
self.w(" ; 0x%04x\n" % (self.pos)) self.w((" ; 0x%04x\n" % (self.pos)).encode())
def w_data(self, data): def w_data(self, data):
w, n = self.w, len(data) w, n = self.w, len(data)
@@ -156,10 +156,10 @@ class DataWriter_nasm(DataWriter):
if i & 15 == 0: if i & 15 == 0:
self.w_eol() self.w_eol()
self.w_bol(i) self.w_bol(i)
w("db ") w("db ".encode())
else: else:
w(",") w(",".encode())
w("%3d" % ord(data[i])) w(("%3d" % ord(data[i])).encode())
nn = ((n + 15) & ~15) - n nn = ((n + 15) & ~15) - n
self.w_eol(" " * 4 * nn) self.w_eol(" " * 4 * nn)
@@ -169,21 +169,21 @@ class DataWriter_nasm(DataWriter):
# ************************************************************************/ # ************************************************************************/
def w_checksum_c(w, s, data): def w_checksum_c(w, s, data):
w("#define %s_SIZE %d\n" % (s, len(data))) w(("#define %s_SIZE %d\n" % (s, len(data))).encode())
w("#define %s_ADLER32 0x%08x\n" % (s, 0xffffffffL & zlib.adler32(data))) w(("#define %s_ADLER32 0x%08x\n" % (s, 0xffffffff & zlib.adler32(data))).encode())
w("#define %s_CRC32 0x%08x\n" % (s, 0xffffffffL & zlib.crc32(data))) w(("#define %s_CRC32 0x%08x\n" % (s, 0xffffffff & zlib.crc32(data))).encode())
w("\n") w("\n".encode())
def write_stub(w, odata, method_index, methods): def write_stub(w, odata, method_index, methods):
method = methods[method_index] method = methods[method_index]
if len(methods) > 1: if len(methods) > 1:
if method_index == 0: if method_index == 0:
w("#if (%s == %d)\n\n" % (opts.mname, method)) w(("#if (%s == %d)\n\n" % (opts.mname, method)).encode())
elif method_index < len(methods) - 1: elif method_index < len(methods) - 1:
w("\n#elif (%s == %d)\n\n" % (opts.mname, method)) w(("\n#elif (%s == %d)\n\n" % (opts.mname, method)).encode())
else: else:
w("\n#else\n\n") w("\n#else\n\n".encode())
if opts.ident: if opts.ident:
if opts.mode == "c": if opts.mode == "c":
@@ -193,8 +193,8 @@ def write_stub(w, odata, method_index, methods):
#w("#if defined(__ELF__)\n") #w("#if defined(__ELF__)\n")
#w('__attribute__((__section__("upx_stubs")))\n') #w('__attribute__((__section__("upx_stubs")))\n')
#w("#endif\n") #w("#endif\n")
w("ATTRIBUTE_FOR_STUB(%s)\n" % (opts.ident)) w(("ATTRIBUTE_FOR_STUB(%s)\n" % (opts.ident)).encode())
w("unsigned char %s[%d] = {\n" % (opts.ident, len(odata))) w(("unsigned char %s[%d] = {\n" % (opts.ident, len(odata))).encode())
if opts.mode == "c": if opts.mode == "c":
DataWriter_c(w).w_data(odata) DataWriter_c(w).w_data(odata)
elif opts.mode == "gas": elif opts.mode == "gas":
@@ -209,11 +209,11 @@ def write_stub(w, odata, method_index, methods):
assert 0, ("invalid mode", opts.mode) assert 0, ("invalid mode", opts.mode)
if opts.ident: if opts.ident:
if opts.mode == "c": if opts.mode == "c":
w("};\n") w("};\n".encode())
if len(methods) > 1: if len(methods) > 1:
if method_index == len(methods) - 1: if method_index == len(methods) - 1:
w("\n#endif\n") w("\n#endif\n".encode())
# /*********************************************************************** # /***********************************************************************
@@ -293,10 +293,10 @@ def main(argv):
# check file size # check file size
st = os.stat(ifile) st = os.stat(ifile)
if 1 and st.st_size <= 0: if 1 and st.st_size <= 0:
print >> sys.stderr, "%s: ERROR: empty file" % (ifile) sys.stderr.write("%s: ERROR: empty file\n" % (ifile))
sys.exit(1) sys.exit(1)
if 1 and st.st_size > 128*1024: if 1 and st.st_size > 128*1024:
print >> sys.stderr, "%s: ERROR: file is too big (%d bytes)" % (ifile, st.st_size) sys.stderr.write("%s: ERROR: file is too big (%d bytes)\n" % (ifile, st.st_size))
sys.exit(1) sys.exit(1)
# read ifile # read ifile
@@ -321,19 +321,22 @@ def main(argv):
# compress stubs # compress stubs
# (process in reverse order so that incompressible do not get sorted first) # (process in reverse order so that incompressible do not get sorted first)
mdata, mdata_odata = [], {} mdata, mdata_odata = [], {}
assert len(opts.methods) >= 1 ### FIXME assert len(opts.methods) >= 1
r_methods = opts.methods[:] ### r_methods = opts.methods[:]
r_methods.reverse() ### r_methods.reverse()
r_methods = [];
for m in opts.methods:
r_methods.insert(0, m)
for method in r_methods: for method in r_methods:
method, odata = compress_stub(method, idata) method, odata = compress_stub(method, idata)
if mdata_odata.has_key(method): if method in mdata_odata:
assert mdata_odata[method] == odata assert mdata_odata[method] == odata
else: else:
mdata_odata[method] = odata mdata_odata[method] = odata
mdata.append(method) mdata.append(method)
assert len(mdata) >= 1 assert len(mdata) >= 1
mdata.reverse() mdata.reverse()
##print opts.methods, [(i, len(mdata_odata[i])) for i in mdata] ##print (opts.methods, [(i, len(mdata_odata[i])) for i in mdata])
# write ofile # write ofile
if opts.dry_run: if opts.dry_run:
@@ -349,7 +352,7 @@ def main(argv):
if opts.mode == "c": if opts.mode == "c":
if opts.verbose >= 0: if opts.verbose >= 0:
w_header_c(w, ifile, ofile, len(idata)) w_header_c(w, ifile, ofile, len(idata))
w("/* clang" + "-format" + " off */\n\n") w(("/* clang" + "-format" + " off */\n\n").encode())
for i in range(len(mdata)): for i in range(len(mdata)):
write_stub(w, mdata_odata[mdata[i]], i, mdata) write_stub(w, mdata_odata[mdata[i]], i, mdata)
if ofp: if ofp:
+8 -8
View File
@@ -1,4 +1,4 @@
#! /usr/bin/env python2 #! /usr/bin/env python3
## vim:set ts=4 sw=4 et: -*- coding: utf-8 -*- ## vim:set ts=4 sw=4 et: -*- coding: utf-8 -*-
# #
# brandelf.py -- # brandelf.py --
@@ -54,32 +54,32 @@ def do_file(fn):
def write(s): def write(s):
if not opts.dry_run: if not opts.dry_run:
fp.write(s) fp.write(s.encode())
def brand_arm(s): def brand_arm(s):
if e_ident[4:7] != s: if e_ident[4:7] != s.encode():
raise Exception("%s is not %s" % (fn, opts.bfdname)) raise Exception("%s is not %s" % (fn, opts.bfdname))
write("\x61") # ELFOSABI_ARM write("\x61") # ELFOSABI_ARM
def brand_freebsd(s): def brand_freebsd(s):
if e_ident[4:7] != s: if e_ident[4:7] != s.encode():
raise Exception("%s is not %s" % (fn, opts.bfdname)) raise Exception("%s is not %s" % (fn, opts.bfdname))
write("\x09") write("\x09")
def brand_linux(s): def brand_linux(s):
if e_ident[4:7] != s: if e_ident[4:7] != s.encode():
raise Exception("%s is not %s" % (fn, opts.bfdname)) raise Exception("%s is not %s" % (fn, opts.bfdname))
##write("\x00Linux\x00\x00\x00") ##write("\x00Linux\x00\x00\x00")
write("\x00" * 9) write("\x00" * 9)
def brand_netbsd(s): def brand_netbsd(s):
if e_ident[4:7] != s: if e_ident[4:7] != s.encode():
raise Exception("%s is not %s" % (fn, opts.bfdname)) raise Exception("%s is not %s" % (fn, opts.bfdname))
write("\x02") write("\x02")
def brand_openbsd(s): def brand_openbsd(s):
if e_ident[4:7] != s: if e_ident[4:7] != s.encode():
raise Exception("%s is not %s" % (fn, opts.bfdname)) raise Exception("%s is not %s" % (fn, opts.bfdname))
write("\x0c") write("\x0c")
if opts.bfdname[:3] == "elf": if opts.bfdname[:3] == "elf":
if e_ident[:4] != "\x7f\x45\x4c\x46": if e_ident[:4] != "\x7f\x45\x4c\x46".encode():
raise Exception("%s is not %s" % (fn, "ELF")) raise Exception("%s is not %s" % (fn, "ELF"))
fp.seek(7, 0) fp.seek(7, 0)
if opts.bfdname == "elf32-bigarm" and opts.elfosabi == "arm": if opts.bfdname == "elf32-bigarm" and opts.elfosabi == "arm":
+8 -8
View File
@@ -1,4 +1,4 @@
#! /usr/bin/env python2 #! /usr/bin/env python3
## vim:set ts=4 sw=4 et: -*- coding: utf-8 -*- ## vim:set ts=4 sw=4 et: -*- coding: utf-8 -*-
# #
# gpp_inc.py -- Generic PreProcessor: include # gpp_inc.py -- Generic PreProcessor: include
@@ -83,7 +83,7 @@ def parse_comment(state, l, comment):
def handle_inc_c(state, l, ofp): def handle_inc_c(state, l, ofp):
m = re.search(r"^\s*\#\s*include\s+([\"\<])(.+?)([\"\>])(.*)$", l) m = re.search(r"^\s*\#\s*include\s+([\"\<])(.+?)([\"\>])(.*)$", l.decode())
if not m: if not m:
return l return l
q1, inc, q2, comment = m.groups() q1, inc, q2, comment = m.groups()
@@ -93,7 +93,7 @@ def handle_inc_c(state, l, ofp):
elif q1 == '"' and q2 == '"': elif q1 == '"' and q2 == '"':
dirs = [state[1]] + opts.includes dirs = [state[1]] + opts.includes
else: else:
raise Exception("syntax error: include line " + l) raise Exception("syntax error: include line " + l.decode())
for dir in dirs: for dir in dirs:
fn = os.path.join(dir, inc) fn = os.path.join(dir, inc)
if os.path.isfile(fn): if os.path.isfile(fn):
@@ -130,13 +130,13 @@ def handle_file(ifn, ofp, parent_state=None):
ifp = open(ifn, "rb") ifp = open(ifn, "rb")
for l in ifp.readlines(): for l in ifp.readlines():
state[2] += 1 # line counter state[2] += 1 # line counter
l = l.rstrip("\n") l = l.rstrip("\n".encode())
if opts.mode == "c": if opts.mode == "c":
l = handle_inc_c(state, l, ofp) l = handle_inc_c(state, l, ofp)
elif opts.mode == "nasm": elif opts.mode == "nasm":
l = handle_inc_nasm(state, l, ofp) l = handle_inc_nasm(state, l, ofp)
if l is not None: if l is not None:
ofp.write(l + "\n") ofp.write(l + "\n".encode())
def main(argv): def main(argv):
@@ -179,12 +179,12 @@ def main(argv):
os.unlink(fn) os.unlink(fn)
if files_mmd: if files_mmd:
fp = open(fn, "wb") fp = open(fn, "wb")
fp.write("%s : \\\n" % opts.target_mmd) fp.write(("%s : \\\n" % opts.target_mmd).encode())
for i, f in enumerate(files_mmd): for i, f in enumerate(files_mmd):
if i < len(files_mmd) - 1: if i < len(files_mmd) - 1:
fp.write(" %s \\\n" % f) fp.write((" %s \\\n" % f).encode())
else: else:
fp.write(" %s\n" % f) fp.write((" %s\n" % f).encode())
fp.close() fp.close()
+13 -13
View File
@@ -1,4 +1,4 @@
#! /usr/bin/env python2 #! /usr/bin/env python3
## vim:set ts=4 sw=4 et: -*- coding: utf-8 -*- ## vim:set ts=4 sw=4 et: -*- coding: utf-8 -*-
# #
# xstrip.py -- truncate ELF objects created by multiarch-objcopy-2.17 # xstrip.py -- truncate ELF objects created by multiarch-objcopy-2.17
@@ -46,7 +46,7 @@ def strip_with_dump(dump_fn, eh, idata):
new_len = 0 new_len = 0
lines = open(dump_fn, "rb").readlines() lines = open(dump_fn, "rb").readlines()
for l in lines: for l in lines:
l = re.sub(r"\s+", " ", l.strip()) l = re.sub(r"\s+", " ", l.strip().decode())
f = l.split(" ") f = l.split(" ")
if len(f) >= 8: if len(f) >= 8:
if f[7].startswith("CONTENTS"): if f[7].startswith("CONTENTS"):
@@ -54,9 +54,9 @@ def strip_with_dump(dump_fn, eh, idata):
sh_size = int("0x" + f[2], 16) sh_size = int("0x" + f[2], 16)
if sh_offset + sh_size > new_len: if sh_offset + sh_size > new_len:
new_len = sh_offset + sh_size new_len = sh_offset + sh_size
##print sh_offset, sh_size, f ##print (sh_offset, sh_size, f)
if new_len > len(eh): if new_len > len(eh):
##print dump_fn, new_len ##print (dump_fn, new_len)
return eh, idata[:new_len-len(eh)] return eh, idata[:new_len-len(eh)]
return eh, idata return eh, idata
@@ -67,7 +67,7 @@ def strip_with_dump(dump_fn, eh, idata):
def check_dump(dump_fn): def check_dump(dump_fn):
lines = open(dump_fn, "rb").readlines() lines = open(dump_fn, "rb").readlines()
lines = map(lambda l: re.sub(r"\s+", " ", l.strip()).strip(), lines) lines = map(lambda l: re.sub(r"\s+", " ", l.strip().decode()).strip(), lines)
lines = filter(None, lines) lines = filter(None, lines)
d = "\n".join(lines) d = "\n".join(lines)
psections = d.find("Sections:\n") psections = d.find("Sections:\n")
@@ -88,10 +88,10 @@ def check_dump(dump_fn):
assert int(f[0], 10) == len(sections) assert int(f[0], 10) == len(sections)
e = f[1], int(f[2], 16), int(f[5], 16), int(f[6][3:], 10), len(sections) e = f[1], int(f[2], 16), int(f[5], 16), int(f[6][3:], 10), len(sections)
sections.append(e) sections.append(e)
assert not section_names.has_key(e[0]), e assert not e[0] in section_names, e
assert not e[0].endswith(":"), ("bad section name", e) assert not e[0].endswith(":"), ("bad section name", e)
section_names[e[0]] = e section_names[e[0]] = e
##print sections ##print (sections)
# preprocessSymbols # preprocessSymbols
symbols = [] symbols = []
section = None section = None
@@ -140,25 +140,25 @@ def do_file(fn):
fp = open(fn, "r+b") fp = open(fn, "r+b")
fp.seek(0, 0) fp.seek(0, 0)
idata = fp.read() idata = fp.read()
if idata[:4] != "\x7f\x45\x4c\x46": if idata[:4] != "\x7f\x45\x4c\x46".encode():
raise Exception("%s is not %s" % (fn, "ELF")) raise Exception("%s is not %s" % (fn, "ELF"))
if idata[4:7] == "\x01\x01\x01": if idata[4:7] == "\x01\x01\x01".encode():
# ELF32 LE # ELF32 LE
eh, idata = idata[:52], idata[52:] eh, idata = idata[:52], idata[52:]
e_shnum, e_shstrndx = struct.unpack("<HH", eh[48:52]) e_shnum, e_shstrndx = struct.unpack("<HH", eh[48:52])
assert e_shstrndx + 3 == e_shnum assert e_shstrndx + 3 == e_shnum
##eh = eh[:48] + struct.pack("<HH", e_shnum - 3, e_shstrndx) ##eh = eh[:48] + struct.pack("<HH", e_shnum - 3, e_shstrndx)
elif idata[4:7] == "\x01\x02\x01": elif idata[4:7] == "\x01\x02\x01".encode():
# ELF32 BE # ELF32 BE
eh, idata = idata[:52], idata[52:] eh, idata = idata[:52], idata[52:]
e_shnum, e_shstrndx = struct.unpack(">HH", eh[48:52]) e_shnum, e_shstrndx = struct.unpack(">HH", eh[48:52])
assert e_shstrndx + 3 == e_shnum assert e_shstrndx + 3 == e_shnum
elif idata[4:7] == "\x02\x01\x01": elif idata[4:7] == "\x02\x01\x01".encode():
# ELF64 LE # ELF64 LE
eh, idata = idata[:64], idata[64:] eh, idata = idata[:64], idata[64:]
e_shnum, e_shstrndx = struct.unpack("<HH", eh[60:64]) e_shnum, e_shstrndx = struct.unpack("<HH", eh[60:64])
assert e_shstrndx + 3 == e_shnum assert e_shstrndx + 3 == e_shnum
elif idata[4:7] == "\x02\x02\x01": elif idata[4:7] == "\x02\x02\x01".encode():
# ELF64 BE # ELF64 BE
eh, idata = idata[:64], idata[64:] eh, idata = idata[:64], idata[64:]
e_shnum, e_shstrndx = struct.unpack(">HH", eh[60:64]) e_shnum, e_shstrndx = struct.unpack(">HH", eh[60:64])
@@ -167,7 +167,7 @@ def do_file(fn):
raise Exception("%s is not %s" % (fn, "ELF")) raise Exception("%s is not %s" % (fn, "ELF"))
odata = None odata = None
pos = idata.find("\0.symtab\0.strtab\0.shstrtab\0") pos = idata.find("\0.symtab\0.strtab\0.shstrtab\0".encode())
if opts.with_dump: if opts.with_dump:
eh, odata = strip_with_dump(opts.with_dump, eh, idata) eh, odata = strip_with_dump(opts.with_dump, eh, idata)
# Other compilers can intermix the contents of .rela sections # Other compilers can intermix the contents of .rela sections
+2 -2
View File
@@ -198,7 +198,7 @@ ifneq ($(wildcard $(WATCOM)/binl/wcl),)
# step 3: clean asm # step 3: clean asm
lzma_d_c%.S : tmp/lzma_d_c%.i cleanasm.py $(MAKEFILE_LIST) lzma_d_c%.S : tmp/lzma_d_c%.i cleanasm.py $(MAKEFILE_LIST)
$(PYTHON) cleanasm.py --label-prefix=$(LABEL_PREFIX) $< $@ $(PYTHON2) cleanasm.py --label-prefix=$(LABEL_PREFIX) $< $@
# step 2: compile, strip and disasm # step 2: compile, strip and disasm
tmp/lzma_d_c%.i : tmp/lzma_d_c%.S $(MAKEFILE_LIST) tmp/lzma_d_c%.i : tmp/lzma_d_c%.S $(MAKEFILE_LIST)
@@ -233,7 +233,7 @@ ifneq ($(wildcard $(WATCOM)/binl/wcl),)
$(call tc,wdis) tmp/$T_wc.obj | $(RTRIM) > tmp/$T_wc.obj.disasm $(call tc,wdis) tmp/$T_wc.obj | $(RTRIM) > tmp/$T_wc.obj.disasm
endif endif
# convert # convert
$(PYTHON) wdis2gas.py tmp/$T_wc.obj.disasm $@ $(PYTHON2) wdis2gas.py tmp/$T_wc.obj.disasm $@
.PRECIOUS: tmp/lzma_d_c%.i tmp/lzma_d_c%.S .PRECIOUS: tmp/lzma_d_c%.i tmp/lzma_d_c%.S
+32 -16
View File
@@ -192,58 +192,74 @@ forceinline constexpr void set_le64(byte *p, upx_uint64_t v) noexcept {
forceinline constexpr upx_uint16_t get_ne16(const byte *p) noexcept { forceinline constexpr upx_uint16_t get_ne16(const byte *p) noexcept {
#if (ACC_ABI_BIG_ENDIAN) #if (ACC_ABI_BIG_ENDIAN)
return get_be16(p); return get_be16(p);
#else #elif (ACC_ABI_LITTLE_ENDIAN)
return get_le16(p); return get_le16(p);
#else
#error "ACC_ABI_ENDIAN"
#endif #endif
} }
forceinline constexpr upx_uint32_t get_ne24(const byte *p) noexcept { forceinline constexpr upx_uint32_t get_ne24(const byte *p) noexcept {
#if (ACC_ABI_BIG_ENDIAN) #if (ACC_ABI_BIG_ENDIAN)
return get_be24(p); return get_be24(p);
#else #elif (ACC_ABI_LITTLE_ENDIAN)
return get_le24(p); return get_le24(p);
#else
#error "ACC_ABI_ENDIAN"
#endif #endif
} }
forceinline constexpr upx_uint32_t get_ne32(const byte *p) noexcept { forceinline constexpr upx_uint32_t get_ne32(const byte *p) noexcept {
#if (ACC_ABI_BIG_ENDIAN) #if (ACC_ABI_BIG_ENDIAN)
return get_be32(p); return get_be32(p);
#else #elif (ACC_ABI_LITTLE_ENDIAN)
return get_le32(p); return get_le32(p);
#else
#error "ACC_ABI_ENDIAN"
#endif #endif
} }
forceinline constexpr upx_uint64_t get_ne64(const byte *p) noexcept { forceinline constexpr upx_uint64_t get_ne64(const byte *p) noexcept {
#if (ACC_ABI_BIG_ENDIAN) #if (ACC_ABI_BIG_ENDIAN)
return get_be64(p); return get_be64(p);
#else #elif (ACC_ABI_LITTLE_ENDIAN)
return get_le64(p); return get_le64(p);
#else
#error "ACC_ABI_ENDIAN"
#endif #endif
} }
forceinline constexpr void set_ne16(byte *p, upx_uint16_t v) noexcept { forceinline constexpr void set_ne16(byte *p, upx_uint16_t v) noexcept {
#if (ACC_ABI_BIG_ENDIAN) #if (ACC_ABI_BIG_ENDIAN)
set_be16(p, v); set_be16(p, v);
#else #elif (ACC_ABI_LITTLE_ENDIAN)
set_le16(p, v); set_le16(p, v);
#else
#error "ACC_ABI_ENDIAN"
#endif #endif
} }
forceinline constexpr void set_ne24(byte *p, upx_uint32_t v) noexcept { forceinline constexpr void set_ne24(byte *p, upx_uint32_t v) noexcept {
#if (ACC_ABI_BIG_ENDIAN) #if (ACC_ABI_BIG_ENDIAN)
set_be24(p, v); set_be24(p, v);
#else #elif (ACC_ABI_LITTLE_ENDIAN)
set_le24(p, v); set_le24(p, v);
#else
#error "ACC_ABI_ENDIAN"
#endif #endif
} }
forceinline constexpr void set_ne32(byte *p, upx_uint32_t v) noexcept { forceinline constexpr void set_ne32(byte *p, upx_uint32_t v) noexcept {
#if (ACC_ABI_BIG_ENDIAN) #if (ACC_ABI_BIG_ENDIAN)
set_be32(p, v); set_be32(p, v);
#else #elif (ACC_ABI_LITTLE_ENDIAN)
set_le32(p, v); set_le32(p, v);
#else
#error "ACC_ABI_ENDIAN"
#endif #endif
} }
forceinline constexpr void set_ne64(byte *p, upx_uint64_t v) noexcept { forceinline constexpr void set_ne64(byte *p, upx_uint64_t v) noexcept {
#if (ACC_ABI_BIG_ENDIAN) #if (ACC_ABI_BIG_ENDIAN)
set_be64(p, v); set_be64(p, v);
#else #elif (ACC_ABI_LITTLE_ENDIAN)
set_le64(p, v); set_le64(p, v);
#else
#error "ACC_ABI_ENDIAN"
#endif #endif
} }
@@ -357,16 +373,17 @@ private:
#define UPX_CXX_DISABLE_NEW_DELETE_NO_VIRTUAL(Klass) private: #define UPX_CXX_DISABLE_NEW_DELETE_NO_VIRTUAL(Klass) private:
#endif #endif
class noncopyable { class NonCopyAble {
protected: protected:
forceinline constexpr noncopyable() noexcept {} forceinline constexpr NonCopyAble() noexcept {}
#if __cplusplus >= 202002L #if __cplusplus >= 202002L
forceinline constexpr ~noncopyable() noexcept = default; forceinline constexpr ~NonCopyAble() noexcept = default;
#else #else
forceinline ~noncopyable() noexcept = default; forceinline ~NonCopyAble() noexcept = default;
#endif #endif
UPX_CXX_DISABLE_COPY_MOVE(noncopyable) UPX_CXX_DISABLE_COPY_MOVE(NonCopyAble)
}; };
typedef NonCopyAble noncopyable;
/************************************************************************* /*************************************************************************
// <type_traits> // <type_traits>
@@ -477,7 +494,6 @@ forceinline constexpr T wrapping_add(const T &a, const T &b) noexcept {
typedef std::make_unsigned_t<T> U; typedef std::make_unsigned_t<T> U;
return T(U(a) + U(b)); return T(U(a) + U(b));
} }
template <class T> template <class T>
forceinline constexpr T wrapping_sub(const T &a, const T &b) noexcept { forceinline constexpr T wrapping_sub(const T &a, const T &b) noexcept {
static_assert(std::is_integral_v<T>); static_assert(std::is_integral_v<T>);
@@ -607,10 +623,10 @@ struct TriBool final {
static constexpr bool is_third_true = IsThirdTrue; static constexpr bool is_third_true = IsThirdTrue;
// types // types
typedef T underlying_type; typedef T underlying_type;
static_assert(std::is_integral_v<underlying_type>);
typedef decltype(T(0) + T(0)) promoted_type; typedef decltype(T(0) + T(0)) promoted_type;
static_assert(std::is_integral_v<promoted_type>);
enum value_type : underlying_type { False = 0, True = 1, Third = 2 }; enum value_type : underlying_type { False = 0, True = 1, Third = 2 };
static_assert(std::is_integral_v<underlying_type>);
static_assert(std::is_integral_v<promoted_type>);
static_assert(sizeof(value_type) == sizeof(underlying_type)); static_assert(sizeof(value_type) == sizeof(underlying_type));
static_assert(sizeof(underlying_type) <= sizeof(promoted_type)); static_assert(sizeof(underlying_type) <= sizeof(promoted_type));
// constructors // constructors
+229 -100
View File
@@ -33,7 +33,8 @@
// extra functions to reduce dependency on membuffer.h // extra functions to reduce dependency on membuffer.h
void *membuffer_get_void_ptr(MemBuffer &mb) noexcept { return mb.getVoidPtr(); } void *membuffer_get_void_ptr(MemBuffer &mb) noexcept { return mb.getVoidPtr(); }
unsigned membuffer_get_size(MemBuffer &mb) noexcept { return mb.getSize(); } const void *membuffer_get_void_ptr(const MemBuffer &mb) noexcept { return mb.getVoidPtr(); }
unsigned membuffer_get_size_in_bytes(const MemBuffer &mb) noexcept { return mb.getSizeInBytes(); }
/*static*/ MemBuffer::Stats MemBuffer::stats; /*static*/ MemBuffer::Stats MemBuffer::stats;
@@ -61,7 +62,7 @@ static noinline void init_use_simple_mcheck() noexcept {
} }
use_simple_mcheck_flag = r; use_simple_mcheck_flag = r;
} }
static bool use_simple_mcheck() noexcept { static noinline bool use_simple_mcheck() noexcept {
static upx_std_once_flag init_done; static upx_std_once_flag init_done;
upx_std_call_once(init_done, init_use_simple_mcheck); upx_std_call_once(init_done, init_use_simple_mcheck);
// NOTE: clang-analyzer-unix.Malloc does not know that this flag is "constant"; see below // NOTE: clang-analyzer-unix.Malloc does not know that this flag is "constant"; see below
@@ -83,22 +84,6 @@ MemBuffer::MemBuffer(upx_uint64_t bytes) may_throw : MemBufferBase<byte>() {
MemBuffer::~MemBuffer() noexcept { this->dealloc(); } MemBuffer::~MemBuffer() noexcept { this->dealloc(); }
// similar to BoundedPtr, except checks only at creation
// skip == offset, take == size_in_bytes
void *MemBuffer::subref_impl(const char *errfmt, size_t skip, size_t take) {
debug_set(debug.last_return_address_subref, upx_return_address());
// check overrun and wrap-around
if (skip + take > size_in_bytes || skip + take < skip) {
char buf[100];
// printf is using unsigned formatting
if (!errfmt || !errfmt[0])
errfmt = "bad subref %#x %#x";
upx_safe_snprintf(buf, sizeof(buf), errfmt, (unsigned) skip, (unsigned) take);
throwCantPack(buf);
}
return ptr + skip;
}
/*static*/ /*static*/
unsigned MemBuffer::getSizeForCompression(unsigned uncompressed_size, unsigned extra) { unsigned MemBuffer::getSizeForCompression(unsigned uncompressed_size, unsigned extra) {
if (uncompressed_size == 0) if (uncompressed_size == 0)
@@ -134,13 +119,31 @@ void MemBuffer::allocForDecompression(unsigned uncompressed_size, unsigned extra
debug_set(debug.last_return_address_alloc, upx_return_address()); debug_set(debug.last_return_address_alloc, upx_return_address());
} }
void MemBuffer::fill(unsigned off, unsigned len, int value) { void MemBuffer::fill(size_t off, size_t bytes, int value) {
debug_set(debug.last_return_address_fill, upx_return_address()); debug_set(debug.last_return_address_fill, upx_return_address());
checkState(); checkState();
if (off > size_in_bytes || len > size_in_bytes || off + len > size_in_bytes) // check overrun and wrap-around
if very_unlikely (off + bytes > size_in_bytes || off + bytes < off)
throwCantPack("MemBuffer::fill out of range; take care!"); throwCantPack("MemBuffer::fill out of range; take care!");
if (len > 0) if (bytes > 0)
memset(ptr + off, value, len); memset(ptr + off, value, bytes);
}
// similar to BoundedPtr, except checks only at creation
// skip == offset, take == size_in_bytes
void *MemBuffer::subref_impl(const char *errfmt, size_t skip, size_t take) {
debug_set(debug.last_return_address_subref, upx_return_address());
checkState();
// check overrun and wrap-around
if very_unlikely (skip + take > size_in_bytes || skip + take < skip) {
char buf[100];
// printf is using unsigned formatting
if (!errfmt || !errfmt[0])
errfmt = "bad subref %#x %#x";
upx_safe_snprintf(buf, sizeof(buf), errfmt, (unsigned) skip, (unsigned) take);
throwCantPack(buf);
}
return ptr + skip;
} }
/************************************************************************* /*************************************************************************
@@ -153,21 +156,21 @@ void MemBuffer::fill(unsigned off, unsigned len, int value) {
#define MAGIC2(p) ((PTR_BITS32(p) ^ 0xfefdbeeb ^ 0x88224411) | 1) #define MAGIC2(p) ((PTR_BITS32(p) ^ 0xfefdbeeb ^ 0x88224411) | 1)
void MemBuffer::checkState() const may_throw { void MemBuffer::checkState() const may_throw {
if (!ptr) if very_unlikely (ptr == nullptr)
throwInternalError("block not allocated"); throwInternalError("block not allocated");
assert(size_in_bytes > 0); assert(size_in_bytes > 0);
if (use_simple_mcheck()) { if (use_simple_mcheck()) {
const byte *p = (const byte *) ptr; const byte *p = (const byte *) ptr;
if (get_ne32(p - 4) != MAGIC1(p)) if very_unlikely (get_ne32(p - 4) != MAGIC1(p))
throwInternalError("memory clobbered before allocated block 1"); throwInternalError("memory clobbered before allocated block 1");
if (get_ne32(p - 8) != size_in_bytes) if very_unlikely (get_ne32(p - 8) != size_in_bytes)
throwInternalError("memory clobbered before allocated block 2"); throwInternalError("memory clobbered before allocated block 2");
if (get_ne32(p + size_in_bytes) != MAGIC2(p)) if very_unlikely (get_ne32(p + size_in_bytes) != MAGIC2(p))
throwInternalError("memory clobbered past end of allocated block"); throwInternalError("memory clobbered past end of allocated block");
} }
} }
void MemBuffer::alloc(upx_uint64_t bytes) may_throw { void MemBuffer::alloc(const upx_uint64_t bytes) may_throw {
// INFO: we don't automatically free a used buffer // INFO: we don't automatically free a used buffer
assert(ptr == nullptr); assert(ptr == nullptr);
assert(size_in_bytes == 0); assert(size_in_bytes == 0);
@@ -183,7 +186,7 @@ void MemBuffer::alloc(upx_uint64_t bytes) may_throw {
NO_printf("MemBuffer::alloc %llu: %p\n", bytes, p); NO_printf("MemBuffer::alloc %llu: %p\n", bytes, p);
if (!p) if (!p)
throwOutOfMemoryException(); throwOutOfMemoryException();
size_in_bytes = ACC_ICONV(unsigned, bytes); size_in_bytes = size_type(bytes);
if (use_simple_mcheck()) { if (use_simple_mcheck()) {
p += 16; p += 16;
// store magic constants to detect buffer overruns // store magic constants to detect buffer overruns
@@ -206,49 +209,60 @@ void MemBuffer::alloc(upx_uint64_t bytes) may_throw {
} }
void MemBuffer::dealloc() noexcept { void MemBuffer::dealloc() noexcept {
if (ptr != nullptr) { if (ptr == nullptr) {
debug_set(debug.last_return_address_dealloc, upx_return_address());
#if DEBUG || 1
// info: calling checkState() here violates "noexcept", so we need a try block
bool shall_check = true;
// bool shall_check = (std::uncaught_exceptions() == 0); // only if not unwinding
// TODO later: add a priority() method to class Throwable
if (shall_check) {
try {
checkState();
} catch (const Throwable &e) {
printErr("unknown", e);
std::terminate();
} catch (...) {
std::terminate();
}
}
#endif
stats.global_dealloc_counter += 1;
stats.global_total_active_bytes -= size_in_bytes;
if (use_simple_mcheck()) {
byte *p = (byte *) ptr;
// clear magic constants
set_ne32(p - 8, 0);
set_ne32(p - 4, 0);
set_ne32(p + size_in_bytes, 0);
set_ne32(p + size_in_bytes + 4, 0);
//
::free(p - 16); // NOLINT(clang-analyzer-unix.Malloc) // see NOTE above
} else {
::free(ptr); // NOLINT(clang-analyzer-unix.Malloc) // see NOTE above
}
ptr = nullptr;
size_in_bytes = 0;
} else {
assert_noexcept(size_in_bytes == 0); assert_noexcept(size_in_bytes == 0);
return;
} }
debug_set(debug.last_return_address_dealloc, upx_return_address());
#if DEBUG || 1
// info: calling checkState() here violates "noexcept", so we need a try block
bool shall_check = true;
// bool shall_check = (std::uncaught_exceptions() == 0); // only if not unwinding
// TODO later: add a priority() method to class Throwable
if (shall_check) {
try {
checkState();
} catch (const Throwable &e) {
printErr("unknown", e);
std::terminate();
} catch (...) {
std::terminate();
}
}
#endif
stats.global_dealloc_counter += 1;
stats.global_total_active_bytes -= size_in_bytes;
if (use_simple_mcheck()) {
byte *p = (byte *) ptr;
// clear magic constants
set_ne32(p - 8, 0);
set_ne32(p - 4, 0);
set_ne32(p + size_in_bytes, 0);
set_ne32(p + size_in_bytes + 4, 0);
//
::free(p - 16); // NOLINT(clang-analyzer-unix.Malloc) // see NOTE above
} else {
::free(ptr); // NOLINT(clang-analyzer-unix.Malloc) // see NOTE above
}
ptr = nullptr;
size_in_bytes = 0;
} }
/************************************************************************* /*************************************************************************
// //
**************************************************************************/ **************************************************************************/
TEST_CASE("MemBuffer unused 1") {
MemBuffer mb;
(void) mb;
}
TEST_CASE("MemBuffer unused 2") {
MemBuffer mb;
CHECK(mb.raw_ptr() == nullptr);
CHECK(mb.raw_size_in_bytes() == 0);
}
TEST_CASE("MemBuffer core") { TEST_CASE("MemBuffer core") {
constexpr size_t N = 64; constexpr size_t N = 64;
MemBuffer mb; MemBuffer mb;
@@ -292,45 +306,160 @@ TEST_CASE("MemBuffer core") {
} }
TEST_CASE("MemBuffer global overloads") { TEST_CASE("MemBuffer global overloads") {
MemBuffer mb(1); {
MemBuffer mb4(4); MemBuffer mb1(1);
mb.clear(); MemBuffer mb4(4);
mb4.clear(); mb1.clear();
CHECK(memcmp(mb, "\x00", 1) == 0); mb4.clear();
CHECK_THROWS(memcmp(mb, "\x00\x00", 2)); // NOLINT(bugprone-unused-return-value) CHECK(memcmp(mb1, "\x00", 1) == 0);
CHECK_THROWS(memcmp("\x00\x00", mb, 2)); // NOLINT(bugprone-unused-return-value) CHECK_THROWS(memcmp(mb1, "\x00\x00", 2)); // NOLINT(bugprone-unused-return-value)
CHECK_THROWS(memcmp(mb, mb4, 2)); // NOLINT(bugprone-unused-return-value) CHECK_THROWS(memcmp("\x00\x00", mb1, 2)); // NOLINT(bugprone-unused-return-value)
CHECK_THROWS(memcmp(mb4, mb, 2)); // NOLINT(bugprone-unused-return-value) CHECK_THROWS(memcmp(mb1, mb4, 2)); // NOLINT(bugprone-unused-return-value)
CHECK_NOTHROW(memset(mb, 255, 1)); CHECK_THROWS(memcmp(mb4, mb1, 2)); // NOLINT(bugprone-unused-return-value)
CHECK_THROWS(memset(mb, 254, 2)); CHECK_NOTHROW(memset(mb1, 255, 1));
CHECK(mb[0] == 255); CHECK_THROWS(memset(mb1, 254, 2));
CHECK_THROWS(get_be16(mb)); CHECK(mb1[0] == 255);
CHECK_THROWS(get_be32(mb)); }
CHECK_THROWS(get_be64(mb));
CHECK_THROWS(get_le16(mb));
CHECK_THROWS(get_le32(mb));
CHECK_THROWS(get_le64(mb));
CHECK_NOTHROW(get_be16(mb4));
CHECK_NOTHROW(get_be32(mb4));
CHECK_THROWS(get_be64(mb4));
CHECK_NOTHROW(get_le16(mb4));
CHECK_NOTHROW(get_le32(mb4));
CHECK_THROWS(get_le64(mb4));
CHECK_NOTHROW(set_be32(mb4, 0));
CHECK_THROWS(set_be64(mb4, 0));
CHECK_NOTHROW(set_le32(mb4, 0));
CHECK_THROWS(set_le64(mb4, 0));
}
TEST_CASE("MemBuffer unused 1") { for (size_t i = 1; i <= 16; i++) {
MemBuffer mb; MemBuffer mb(i);
CHECK(mb.raw_ptr() == nullptr); mb.clear();
CHECK(mb.raw_size_in_bytes() == 0);
}
TEST_CASE("MemBuffer unused 2") { if (i < 2) {
MemBuffer mb; CHECK_THROWS(get_ne16(mb));
(void) mb; CHECK_THROWS(get_be16(mb));
CHECK_THROWS(get_le16(mb));
CHECK_THROWS(set_ne16(mb, 0));
CHECK_THROWS(set_be16(mb, 0));
CHECK_THROWS(set_le16(mb, 0));
} else {
CHECK_NOTHROW(get_ne16(mb));
CHECK_NOTHROW(get_be16(mb));
CHECK_NOTHROW(get_le16(mb));
CHECK_NOTHROW(set_ne16(mb, 0));
CHECK_NOTHROW(set_be16(mb, 0));
CHECK_NOTHROW(set_le16(mb, 0));
}
if (i < 3) {
CHECK_THROWS(get_ne24(mb));
CHECK_THROWS(get_be24(mb));
CHECK_THROWS(get_le24(mb));
CHECK_THROWS(set_ne24(mb, 0));
CHECK_THROWS(set_be24(mb, 0));
CHECK_THROWS(set_le24(mb, 0));
} else {
CHECK_NOTHROW(get_ne24(mb));
CHECK_NOTHROW(get_be24(mb));
CHECK_NOTHROW(get_le24(mb));
CHECK_NOTHROW(set_ne24(mb, 0));
CHECK_NOTHROW(set_be24(mb, 0));
CHECK_NOTHROW(set_le24(mb, 0));
}
if (i < 4) {
CHECK_THROWS(get_ne32(mb));
CHECK_THROWS(get_be32(mb));
CHECK_THROWS(get_le32(mb));
CHECK_THROWS(set_ne32(mb, 0));
CHECK_THROWS(set_be32(mb, 0));
CHECK_THROWS(set_le32(mb, 0));
} else {
CHECK_NOTHROW(get_ne32(mb));
CHECK_NOTHROW(get_be32(mb));
CHECK_NOTHROW(get_le32(mb));
CHECK_NOTHROW(set_ne32(mb, 0));
CHECK_NOTHROW(set_be32(mb, 0));
CHECK_NOTHROW(set_le32(mb, 0));
}
if (i < 8) {
CHECK_THROWS(get_ne64(mb));
CHECK_THROWS(get_be64(mb));
CHECK_THROWS(get_le64(mb));
CHECK_THROWS(set_ne64(mb, 0));
CHECK_THROWS(set_be64(mb, 0));
CHECK_THROWS(set_le64(mb, 0));
} else {
CHECK_NOTHROW(get_ne64(mb));
CHECK_NOTHROW(get_be64(mb));
CHECK_NOTHROW(get_le64(mb));
CHECK_NOTHROW(set_ne64(mb, 0));
CHECK_NOTHROW(set_be64(mb, 0));
CHECK_NOTHROW(set_le64(mb, 0));
}
CHECK_NOTHROW(mb.subref("", 0, 0));
CHECK_NOTHROW(mb.subref("", 0, i));
CHECK_NOTHROW(mb.subref("", i, 0));
CHECK_NOTHROW(mb.subref("", i - 1, 1));
CHECK_THROWS(mb.subref("", 0, i + 1));
CHECK_THROWS(mb.subref("", i + 1, 0));
CHECK_THROWS(mb.subref("", i, 1));
CHECK_THROWS(mb.subref("", (size_t) -1, 0));
CHECK_THROWS(mb.subref("", (size_t) -1, i));
#if DEBUG || !(ACC_CC_CLANG && __PPC64__ && ACC_ABI_BIG_ENDIAN) || 0
// @COMPILER_BUG @CLANG_BUG
if (i < 2) {
CHECK_THROWS(mb.subref("", 0, sizeof(NE16)));
CHECK_THROWS(mb.subref("", 0, sizeof(BE16)));
CHECK_THROWS(mb.subref("", 0, sizeof(LE16)));
} else {
CHECK_NOTHROW(mb.subref("", 0, sizeof(NE16)));
CHECK_NOTHROW(mb.subref("", 0, sizeof(BE16)));
CHECK_NOTHROW(mb.subref("", 0, sizeof(LE16)));
}
if (i < 4) {
CHECK_THROWS(mb.subref("", 0, sizeof(NE32)));
CHECK_THROWS(mb.subref("", 0, sizeof(BE32)));
CHECK_THROWS(mb.subref("", 0, sizeof(LE32)));
} else {
CHECK_NOTHROW(mb.subref("", 0, sizeof(NE32)));
CHECK_NOTHROW(mb.subref("", 0, sizeof(BE32)));
CHECK_NOTHROW(mb.subref("", 0, sizeof(LE32)));
}
if (i < 8) {
CHECK_THROWS(mb.subref("", 0, sizeof(NE64)));
CHECK_THROWS(mb.subref("", 0, sizeof(BE64)));
CHECK_THROWS(mb.subref("", 0, sizeof(LE64)));
} else {
CHECK_NOTHROW(mb.subref("", 0, sizeof(NE64)));
CHECK_NOTHROW(mb.subref("", 0, sizeof(BE64)));
CHECK_NOTHROW(mb.subref("", 0, sizeof(LE64)));
}
CHECK_NOTHROW(mb.subref_u<byte *>("", 0));
CHECK_NOTHROW(mb.subref_u<byte *>("", i - 1));
CHECK_THROWS(mb.subref_u<byte *>("", i));
CHECK_THROWS(mb.subref_u<byte *>("", (size_t) -1));
if (i < 2) {
CHECK_THROWS(mb.subref_u<NE16 *>("", 0));
CHECK_THROWS(mb.subref_u<BE16 *>("", 0));
CHECK_THROWS(mb.subref_u<LE16 *>("", 0));
} else {
CHECK_NOTHROW(mb.subref_u<NE16 *>("", 0));
CHECK_NOTHROW(mb.subref_u<BE16 *>("", 0));
CHECK_NOTHROW(mb.subref_u<LE16 *>("", 0));
}
if (i < 4) {
CHECK_THROWS(mb.subref_u<NE32 *>("", 0));
CHECK_THROWS(mb.subref_u<BE32 *>("", 0));
CHECK_THROWS(mb.subref_u<LE32 *>("", 0));
} else {
CHECK_NOTHROW(mb.subref_u<NE32 *>("", 0));
CHECK_NOTHROW(mb.subref_u<BE32 *>("", 0));
CHECK_NOTHROW(mb.subref_u<LE32 *>("", 0));
}
if (i < 8) {
CHECK_THROWS(mb.subref_u<NE64 *>("", 0));
CHECK_THROWS(mb.subref_u<BE64 *>("", 0));
CHECK_THROWS(mb.subref_u<LE64 *>("", 0));
} else {
CHECK_NOTHROW(mb.subref_u<NE64 *>("", 0));
CHECK_NOTHROW(mb.subref_u<BE64 *>("", 0));
CHECK_NOTHROW(mb.subref_u<LE64 *>("", 0));
}
#endif
}
} }
TEST_CASE("MemBuffer array access") { TEST_CASE("MemBuffer array access") {
+21 -11
View File
@@ -41,9 +41,9 @@ public:
typedef T element_type; typedef T element_type;
typedef typename std::add_lvalue_reference<T>::type reference; typedef typename std::add_lvalue_reference<T>::type reference;
typedef typename std::add_pointer<T>::type pointer; typedef typename std::add_pointer<T>::type pointer;
typedef unsigned size_type; // limited by UPX_RSIZE_MAX
typedef pointer iterator; typedef pointer iterator;
typedef typename std::add_pointer<const T>::type const_iterator; typedef typename std::add_pointer<const T>::type const_iterator;
typedef size_t size_type; // limited by UPX_RSIZE_MAX
protected: protected:
static const size_t element_size = sizeof(element_type); static const size_t element_size = sizeof(element_type);
@@ -62,8 +62,8 @@ public:
// array access // array access
reference operator[](ptrdiff_t i) const may_throw { reference operator[](ptrdiff_t i) const may_throw {
// NOTE: &array[SIZE] is *not* legal for containers like std::vector and MemBuffer ! // NOTE: &array[SIZE] is *not* legal for containers like std::vector and MemBuffer !
if very_unlikely (i < 0 || mem_size(element_size, i) + element_size > size_in_bytes) if very_unlikely (i < 0 || mem_size(element_size, i) >= size_in_bytes)
throwCantPack("MemBuffer invalid array index %td (%u bytes)", i, size_in_bytes); throwCantPack("MemBuffer invalid array index %td (%zu bytes)", i, size_in_bytes);
return ptr[i]; return ptr[i];
} }
// dereference // dereference
@@ -169,8 +169,8 @@ inline typename MemBufferBase<T>::pointer raw_index_bytes(const MemBufferBase<T>
#define XSPAN_REQUIRES_CONVERTIBLE_ANY_DIRECTION(A, B, RType) \ #define XSPAN_REQUIRES_CONVERTIBLE_ANY_DIRECTION(A, B, RType) \
typename std::enable_if<std::is_same<A, B>::value, RType>::type typename std::enable_if<std::is_same<A, B>::value, RType>::type
#endif #endif
#define C MemBufferBase
#define XSPAN_FWD_C_IS_MEMBUFFER 1 #define XSPAN_FWD_C_IS_MEMBUFFER 1
#define C MemBufferBase
#if WITH_XSPAN >= 1 #if WITH_XSPAN >= 1
#define D XSPAN_NS(Ptr) #define D XSPAN_NS(Ptr)
#endif #endif
@@ -194,22 +194,22 @@ public:
static unsigned getSizeForDecompression(unsigned uncompressed_size, unsigned extra = 0) static unsigned getSizeForDecompression(unsigned uncompressed_size, unsigned extra = 0)
may_throw; may_throw;
void alloc(upx_uint64_t bytes) may_throw; noinline void alloc(upx_uint64_t bytes) may_throw;
void allocForCompression(unsigned uncompressed_size, unsigned extra = 0) may_throw; void allocForCompression(unsigned uncompressed_size, unsigned extra = 0) may_throw;
void allocForDecompression(unsigned uncompressed_size, unsigned extra = 0) may_throw; void allocForDecompression(unsigned uncompressed_size, unsigned extra = 0) may_throw;
void dealloc() noexcept; noinline void checkState() const may_throw;
void checkState() const may_throw; noinline void dealloc() noexcept;
// explicit conversion // explicit conversion
void *getVoidPtr() noexcept { return (void *) ptr; } void *getVoidPtr() noexcept { return (void *) ptr; }
const void *getVoidPtr() const noexcept { return (const void *) ptr; } const void *getVoidPtr() const noexcept { return (const void *) ptr; }
unsigned getSizeInBytes() const noexcept { return size_in_bytes; } unsigned getSizeInBytes() const noexcept { return size_in_bytes; }
unsigned getSize() const noexcept { return size_in_bytes; } // note: element_size == 1 unsigned getSize() const noexcept { return size_in_bytes / element_size; }
// util // util
noinline void fill(unsigned off, unsigned len, int value) may_throw; noinline void fill(size_t off, size_t bytes, int value) may_throw;
forceinline void clear(unsigned off, unsigned len) may_throw { fill(off, len, 0); } forceinline void clear(size_t off, size_t bytes) may_throw { fill(off, bytes, 0); }
forceinline void clear() may_throw { fill(0, size_in_bytes, 0); } forceinline void clear() may_throw { fill(0, size_in_bytes, 0); }
// If the entire range [skip, skip+take) is inside the buffer, // If the entire range [skip, skip+take) is inside the buffer,
@@ -219,9 +219,19 @@ public:
forceinline pointer subref(const char *errfmt, size_t skip, size_t take) may_throw { forceinline pointer subref(const char *errfmt, size_t skip, size_t take) may_throw {
return (pointer) subref_impl(errfmt, skip, take); return (pointer) subref_impl(errfmt, skip, take);
} }
template <class U>
forceinline U subref_u(const char *errfmt, size_t skip) may_throw {
COMPILE_TIME_ASSERT(std::is_pointer<U>::value)
return (U) subref_impl(errfmt, skip, sizeof(typename std::remove_pointer<U>::type));
}
template <class U>
forceinline U subref_u(const char *errfmt, size_t skip, size_t take) may_throw {
COMPILE_TIME_ASSERT(std::is_pointer<U>::value)
return (U) subref_impl(errfmt, skip, take);
}
private: private:
void *subref_impl(const char *errfmt, size_t skip, size_t take) may_throw; noinline void *subref_impl(const char *errfmt, size_t skip, size_t take) may_throw;
// static debug stats // static debug stats
struct Stats { struct Stats {
+1 -1
View File
@@ -75,6 +75,6 @@
#define _LIBCPP_HAS_ALIGNED_ALLOCATION 0 #define _LIBCPP_HAS_ALIGNED_ALLOCATION 0
#endif #endif
#endif #endif
#endif #endif // _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
/* vim:set ts=4 sw=4 et: */ /* vim:set ts=4 sw=4 et: */
+30 -29
View File
@@ -71,7 +71,7 @@ bool mem_size_valid(upx_uint64_t element_size, upx_uint64_t n, upx_uint64_t extr
} }
upx_rsize_t mem_size(upx_uint64_t element_size, upx_uint64_t n, upx_uint64_t extra1, upx_rsize_t mem_size(upx_uint64_t element_size, upx_uint64_t n, upx_uint64_t extra1,
upx_uint64_t extra2) { upx_uint64_t extra2) may_throw {
assert(element_size > 0); assert(element_size > 0);
if very_unlikely (element_size == 0 || element_size > UPX_RSIZE_MAX) if very_unlikely (element_size == 0 || element_size > UPX_RSIZE_MAX)
throwCantPack("mem_size 1; take care"); throwCantPack("mem_size 1; take care");
@@ -144,7 +144,8 @@ TEST_CASE("ptr_diff") {
} }
// check that 2 buffers do not overlap; will throw on error // check that 2 buffers do not overlap; will throw on error
void ptraddr_check_no_overlap(upx_ptraddr_t a, size_t a_size, upx_ptraddr_t b, size_t b_size) { void ptraddr_check_no_overlap(upx_ptraddr_t a, size_t a_size, upx_ptraddr_t b, size_t b_size)
may_throw {
if very_unlikely (a == 0 || b == 0) if very_unlikely (a == 0 || b == 0)
throwCantPack("ptr_check_no_overlap-nullptr"); throwCantPack("ptr_check_no_overlap-nullptr");
upx_ptraddr_t a_end = a + mem_size(1, a_size); upx_ptraddr_t a_end = a + mem_size(1, a_size);
@@ -160,7 +161,7 @@ void ptraddr_check_no_overlap(upx_ptraddr_t a, size_t a_size, upx_ptraddr_t b, s
// check that 3 buffers do not overlap; will throw on error // check that 3 buffers do not overlap; will throw on error
void ptraddr_check_no_overlap(upx_ptraddr_t a, size_t a_size, upx_ptraddr_t b, size_t b_size, void ptraddr_check_no_overlap(upx_ptraddr_t a, size_t a_size, upx_ptraddr_t b, size_t b_size,
upx_ptraddr_t c, size_t c_size) { upx_ptraddr_t c, size_t c_size) may_throw {
if very_unlikely (a == 0 || b == 0 || c == 0) if very_unlikely (a == 0 || b == 0 || c == 0)
throwCantPack("ptr_check_no_overlap-nullptr"); throwCantPack("ptr_check_no_overlap-nullptr");
upx_ptraddr_t a_end = a + mem_size(1, a_size); upx_ptraddr_t a_end = a + mem_size(1, a_size);
@@ -253,6 +254,14 @@ TEST_CASE("ptr_check_no_overlap 3") {
// stdlib // stdlib
**************************************************************************/ **************************************************************************/
void *upx_calloc(size_t n, size_t element_size) may_throw {
const upx_rsize_t bytes = mem_size(element_size, n); // assert size
void *p = ::malloc(bytes);
if (p != nullptr && bytes > 0)
memset(p, 0, bytes);
return p;
}
const char *upx_getenv(const char *envvar) noexcept { const char *upx_getenv(const char *envvar) noexcept {
if (envvar != nullptr && envvar[0]) if (envvar != nullptr && envvar[0])
return ::getenv(envvar); return ::getenv(envvar);
@@ -260,11 +269,11 @@ const char *upx_getenv(const char *envvar) noexcept {
} }
// random value from libc; quality is not important for UPX // random value from libc; quality is not important for UPX
int upx_rand(void) noexcept { int upx_rand() noexcept {
return ::rand(); // NOLINT(clang-analyzer-security.insecureAPI.rand) return ::rand(); // NOLINT(clang-analyzer-security.insecureAPI.rand)
} }
void upx_rand_init(void) noexcept { void upx_rand_init() noexcept {
unsigned seed = 0; unsigned seed = 0;
seed ^= UPX_VERSION_HEX; seed ^= UPX_VERSION_HEX;
#if (!HAVE_GETTIMEOFDAY || (ACC_OS_DOS32 && defined(__DJGPP__))) && !defined(__wasi__) #if (!HAVE_GETTIMEOFDAY || (ACC_OS_DOS32 && defined(__DJGPP__))) && !defined(__wasi__)
@@ -282,14 +291,6 @@ void upx_rand_init(void) noexcept {
::srand(seed); ::srand(seed);
} }
void *upx_calloc(size_t n, size_t element_size) may_throw {
size_t bytes = mem_size(element_size, n); // assert size
void *p = ::malloc(bytes);
if (p != nullptr)
memset(p, 0, bytes);
return p;
}
// simple unoptimized memswap() // simple unoptimized memswap()
// TODO later: CHERI clang-14 bug/miscompilation with upx_memswap(); or // TODO later: CHERI clang-14 bug/miscompilation with upx_memswap(); or
// maybe caused by tagged-memory issues ??? // maybe caused by tagged-memory issues ???
@@ -420,6 +421,22 @@ void upx_std_stable_sort(void *array, size_t n, upx_compare_func_t compare) {
#endif #endif
} }
#if UPX_CONFIG_USE_STABLE_SORT
// instantiate function templates for all element sizes we need; efficient
// run-time, but code size bloat (about 4KiB code size for each function
// with my current libstdc++); not really needed as libc qsort() is
// good enough for our use cases
template void upx_std_stable_sort<1>(void *, size_t, upx_compare_func_t);
template void upx_std_stable_sort<2>(void *, size_t, upx_compare_func_t);
template void upx_std_stable_sort<4>(void *, size_t, upx_compare_func_t);
template void upx_std_stable_sort<5>(void *, size_t, upx_compare_func_t);
template void upx_std_stable_sort<8>(void *, size_t, upx_compare_func_t);
template void upx_std_stable_sort<16>(void *, size_t, upx_compare_func_t);
template void upx_std_stable_sort<32>(void *, size_t, upx_compare_func_t);
template void upx_std_stable_sort<56>(void *, size_t, upx_compare_func_t);
template void upx_std_stable_sort<72>(void *, size_t, upx_compare_func_t);
#endif // UPX_CONFIG_USE_STABLE_SORT
TEST_CASE("upx_memswap") { TEST_CASE("upx_memswap") {
auto check4 = [](int off1, int off2, int len, int a, int b, int c, int d) { auto check4 = [](int off1, int off2, int len, int a, int b, int c, int d) {
byte p[4] = {0, 1, 2, 3}; byte p[4] = {0, 1, 2, 3};
@@ -473,22 +490,6 @@ TEST_CASE("upx_memswap") {
} }
} }
#if UPX_CONFIG_USE_STABLE_SORT
// instantiate function templates for all element sizes we need; efficient
// run-time, but code size bloat (about 4KiB code size for each function
// with my current libstdc++); not really needed as libc qsort() is
// good enough for our use cases
template void upx_std_stable_sort<1>(void *, size_t, upx_compare_func_t);
template void upx_std_stable_sort<2>(void *, size_t, upx_compare_func_t);
template void upx_std_stable_sort<4>(void *, size_t, upx_compare_func_t);
template void upx_std_stable_sort<5>(void *, size_t, upx_compare_func_t);
template void upx_std_stable_sort<8>(void *, size_t, upx_compare_func_t);
template void upx_std_stable_sort<16>(void *, size_t, upx_compare_func_t);
template void upx_std_stable_sort<32>(void *, size_t, upx_compare_func_t);
template void upx_std_stable_sort<56>(void *, size_t, upx_compare_func_t);
template void upx_std_stable_sort<72>(void *, size_t, upx_compare_func_t);
#endif // UPX_CONFIG_USE_STABLE_SORT
#if !defined(DOCTEST_CONFIG_DISABLE) && DEBUG #if !defined(DOCTEST_CONFIG_DISABLE) && DEBUG
#if __cplusplus >= 202002L // use C++20 std::next_permutation() to test all permutations #if __cplusplus >= 202002L // use C++20 std::next_permutation() to test all permutations
namespace { namespace {
+25 -13
View File
@@ -67,13 +67,12 @@ inline void mem_size_assert(upx_uint64_t element_size, upx_uint64_t n) may_throw
} }
// "new" with asserted size; will throw on invalid size // "new" with asserted size; will throw on invalid size
#if DEBUG
template <class T> template <class T>
T *NewArray(upx_uint64_t n) may_throw { inline T *NewT(upx_uint64_t n) may_throw {
COMPILE_TIME_ASSERT(std::is_standard_layout<T>::value) COMPILE_TIME_ASSERT(std::is_standard_layout<T>::value)
COMPILE_TIME_ASSERT(std::is_trivially_copyable<T>::value) COMPILE_TIME_ASSERT(std::is_trivially_copyable<T>::value)
COMPILE_TIME_ASSERT(std::is_trivially_default_constructible<T>::value) COMPILE_TIME_ASSERT(std::is_trivially_default_constructible<T>::value)
upx_rsize_t bytes = mem_size(sizeof(T), n); // assert size const upx_rsize_t bytes = mem_size(sizeof(T), n); // assert size
T *array = new T[size_t(n)]; T *array = new T[size_t(n)];
#if !defined(__SANITIZE_MEMORY__) #if !defined(__SANITIZE_MEMORY__)
if (array != nullptr && bytes > 0) { if (array != nullptr && bytes > 0) {
@@ -84,11 +83,25 @@ T *NewArray(upx_uint64_t n) may_throw {
UNUSED(bytes); UNUSED(bytes);
return array; return array;
} }
#define New(type, n) (NewArray<type>((n))) #if DEBUG || 1
#define New(type, n) (NewT<type>((n)))
#else #else
#define New(type, n) new type[mem_size_get_n(sizeof(type), (n))] #define New(type, n) new type[mem_size_get_n(sizeof(type), (n))]
#endif #endif
template <class T>
inline T *New0T(upx_uint64_t n) may_throw {
COMPILE_TIME_ASSERT(std::is_standard_layout<T>::value)
COMPILE_TIME_ASSERT(std::is_trivially_copyable<T>::value)
COMPILE_TIME_ASSERT(std::is_trivially_default_constructible<T>::value)
const upx_rsize_t bytes = mem_size(sizeof(T), n); // assert size
T *array = new T[size_t(n)];
if (array != nullptr && bytes > 0)
memset(array, 0, bytes); // NOLINT(bugprone-multi-level-implicit-pointer-conversion)
return array;
}
#define New0(type, n) (New0T<type>((n)))
/************************************************************************* /*************************************************************************
// ptr util // ptr util
**************************************************************************/ **************************************************************************/
@@ -121,18 +134,17 @@ forceinline bool ptr_is_aligned(const void *p, size_t alignment) noexcept {
// ptrdiff_t with nullptr checks and asserted size; will throw on failure // ptrdiff_t with nullptr checks and asserted size; will throw on failure
// NOTE: returns size_in_bytes, not number of elements! // NOTE: returns size_in_bytes, not number of elements!
int ptr_diff_bytes(const void *a, const void *b) may_throw; noinline int ptr_diff_bytes(const void *a, const void *b) may_throw;
unsigned ptr_udiff_bytes(const void *a, const void *b) may_throw; // asserts a >= b noinline unsigned ptr_udiff_bytes(const void *a, const void *b) may_throw; // asserts a >= b
// short names "ptr_diff" and "ptr_udiff" for types with sizeof(X) == 1 // short names "ptr_diff" and "ptr_udiff" for types with sizeof(X) == 1
template <class T, class U> template <class T, class U>
inline typename std::enable_if<sizeof(T) == 1 && sizeof(U) == 1, int>::type ptr_diff(const T *a, forceinline typename std::enable_if<sizeof(T) == 1 && sizeof(U) == 1, int>::type
const U *b) ptr_diff(const T *a, const U *b) may_throw {
may_throw {
return ptr_diff_bytes(a, b); return ptr_diff_bytes(a, b);
} }
template <class T, class U> template <class T, class U>
inline typename std::enable_if<sizeof(T) == 1 && sizeof(U) == 1, unsigned>::type forceinline typename std::enable_if<sizeof(T) == 1 && sizeof(U) == 1, unsigned>::type
ptr_udiff(const T *a, const U *b) may_throw { ptr_udiff(const T *a, const U *b) may_throw {
return ptr_udiff_bytes(a, b); return ptr_udiff_bytes(a, b);
} }
@@ -181,8 +193,8 @@ noinline const char *upx_getenv(const char *envvar) noexcept;
noinline void upx_memswap(void *a, void *b, size_t bytes) noexcept; noinline void upx_memswap(void *a, void *b, size_t bytes) noexcept;
noinline void upx_rand_init(void) noexcept; noinline void upx_rand_init() noexcept;
noinline int upx_rand(void) noexcept; noinline int upx_rand() noexcept;
typedef int(__acc_cdecl_qsort *upx_compare_func_t)(const void *, const void *); typedef int(__acc_cdecl_qsort *upx_compare_func_t)(const void *, const void *);
typedef void (*upx_sort_func_t)(void *array, size_t n, size_t element_size, upx_compare_func_t); typedef void (*upx_sort_func_t)(void *array, size_t n, size_t element_size, upx_compare_func_t);
@@ -229,7 +241,7 @@ bool maketempname(char *ofilename, size_t size, const char *ifilename, const cha
bool force = true); bool force = true);
bool makebakname(char *ofilename, size_t size, const char *ifilename, bool force = true); bool makebakname(char *ofilename, size_t size, const char *ifilename, bool force = true);
bool is_envvar_true(const char *envvar, const char *alternate_name = nullptr) noexcept; noinline bool is_envvar_true(const char *envvar, const char *alternate_name = nullptr) noexcept;
unsigned get_ratio(upx_uint64_t u_len, upx_uint64_t c_len); unsigned get_ratio(upx_uint64_t u_len, upx_uint64_t c_len);
bool set_method_name(char *buf, size_t size, int method, int level); bool set_method_name(char *buf, size_t size, int method, int level);
+7 -7
View File
@@ -44,33 +44,33 @@ struct XSpanStats {
static XSpanStats xspan_stats; static XSpanStats xspan_stats;
// HINT: set env-var "UPX_DEBUG_DOCTEST_DISABLE=1" for improved debugging experience // HINT: set env-var "UPX_DEBUG_DOCTEST_DISABLE=1" for improved debugging experience
void xspan_fail_nullptr() { void xspan_fail_nullptr() may_throw {
xspan_stats.fail_nullptr += 1; xspan_stats.fail_nullptr += 1;
throwCantPack("xspan unexpected NULL pointer; take care!"); throwCantPack("xspan unexpected NULL pointer; take care!");
} }
void xspan_fail_nullbase() { void xspan_fail_nullbase() may_throw {
xspan_stats.fail_nullbase += 1; xspan_stats.fail_nullbase += 1;
throwCantPack("xspan unexpected NULL base; take care!"); throwCantPack("xspan unexpected NULL base; take care!");
} }
void xspan_fail_not_same_base() { void xspan_fail_not_same_base() may_throw {
xspan_stats.fail_not_same_base += 1; xspan_stats.fail_not_same_base += 1;
throwCantPack("xspan unexpected base pointer; take care!"); throwCantPack("xspan unexpected base pointer; take care!");
} }
void xspan_fail_range_nullptr() { void xspan_fail_range_nullptr() may_throw {
xspan_stats.fail_range_nullptr += 1; xspan_stats.fail_range_nullptr += 1;
throwCantPack("xspan_check_range: unexpected NULL pointer; take care!"); throwCantPack("xspan_check_range: unexpected NULL pointer; take care!");
} }
void xspan_fail_range_nullbase() { void xspan_fail_range_nullbase() may_throw {
xspan_stats.fail_range_nullbase += 1; xspan_stats.fail_range_nullbase += 1;
throwCantPack("xspan_check_range: unexpected NULL base; take care!"); throwCantPack("xspan_check_range: unexpected NULL base; take care!");
} }
void xspan_fail_range_range() { void xspan_fail_range_range() may_throw {
xspan_stats.fail_range_range += 1; xspan_stats.fail_range_range += 1;
throwCantPack("xspan_check_range: pointer out of range; take care!"); throwCantPack("xspan_check_range: pointer out of range; take care!");
} }
void xspan_check_range(const void *ptr, const void *base, ptrdiff_t size_in_bytes) { void xspan_check_range(const void *ptr, const void *base, ptrdiff_t size_in_bytes) may_throw {
xspan_stats.check_range_counter += 1; xspan_stats.check_range_counter += 1;
if very_unlikely (ptr == nullptr) if very_unlikely (ptr == nullptr)
xspan_fail_range_nullptr(); xspan_fail_range_nullptr();
+18 -2
View File
@@ -92,7 +92,7 @@ XSPAN_FWD_TU_VOIDPTR(int) memcmp(const C<T> &a, const E<U> &b, size_t n) {
#endif #endif
template <class T> template <class T>
inline void *memcpy(C<T> a, const void *b, size_t n) { inline void *memcpy(const C<T> a, const void *b, size_t n) {
return memcpy(a.raw_bytes(n), b, n); return memcpy(a.raw_bytes(n), b, n);
} }
template <class T> template <class T>
@@ -114,7 +114,7 @@ XSPAN_FWD_TU_VOIDPTR(void *) memcpy(const C<T> &a, const E<U> &b, size_t n) {
#endif #endif
template <class T> template <class T>
inline void *memmove(C<T> a, const void *b, size_t n) { inline void *memmove(const C<T> a, const void *b, size_t n) {
return memmove(a.raw_bytes(n), b, n); return memmove(a.raw_bytes(n), b, n);
} }
template <class T> template <class T>
@@ -204,6 +204,10 @@ inline unsigned get_ne16(const C<T> &a) {
return get_ne16(a.raw_bytes(2)); return get_ne16(a.raw_bytes(2));
} }
template <class T> template <class T>
inline unsigned get_ne24(const C<T> &a) {
return get_ne24(a.raw_bytes(3));
}
template <class T>
inline unsigned get_ne32(const C<T> &a) { inline unsigned get_ne32(const C<T> &a) {
return get_ne32(a.raw_bytes(4)); return get_ne32(a.raw_bytes(4));
} }
@@ -217,6 +221,10 @@ inline unsigned get_be16(const C<T> &a) {
return get_be16(a.raw_bytes(2)); return get_be16(a.raw_bytes(2));
} }
template <class T> template <class T>
inline unsigned get_be24(const C<T> &a) {
return get_be24(a.raw_bytes(3));
}
template <class T>
inline unsigned get_be32(const C<T> &a) { inline unsigned get_be32(const C<T> &a) {
return get_be32(a.raw_bytes(4)); return get_be32(a.raw_bytes(4));
} }
@@ -247,6 +255,10 @@ inline void set_ne16(const C<T> &a, unsigned v) {
return set_ne16(a.raw_bytes(2), v); return set_ne16(a.raw_bytes(2), v);
} }
template <class T> template <class T>
inline void set_ne24(const C<T> &a, unsigned v) {
return set_ne24(a.raw_bytes(3), v);
}
template <class T>
inline void set_ne32(const C<T> &a, unsigned v) { inline void set_ne32(const C<T> &a, unsigned v) {
return set_ne32(a.raw_bytes(4), v); return set_ne32(a.raw_bytes(4), v);
} }
@@ -260,6 +272,10 @@ inline void set_be16(const C<T> &a, unsigned v) {
return set_be16(a.raw_bytes(2), v); return set_be16(a.raw_bytes(2), v);
} }
template <class T> template <class T>
inline void set_be24(const C<T> &a, unsigned v) {
return set_be24(a.raw_bytes(3), v);
}
template <class T>
inline void set_be32(const C<T> &a, unsigned v) { inline void set_be32(const C<T> &a, unsigned v) {
return set_be32(a.raw_bytes(4), v); return set_be32(a.raw_bytes(4), v);
} }
+6 -6
View File
@@ -43,12 +43,12 @@
XSPAN_NAMESPACE_BEGIN XSPAN_NAMESPACE_BEGIN
// HINT: set env-var "UPX_DEBUG_DOCTEST_DISABLE=1" for improved debugging experience // HINT: set env-var "UPX_DEBUG_DOCTEST_DISABLE=1" for improved debugging experience
noreturn void xspan_fail_nullptr(void) may_throw; noreturn void xspan_fail_nullptr() may_throw;
noreturn void xspan_fail_nullbase(void) may_throw; noreturn void xspan_fail_nullbase() may_throw;
noreturn void xspan_fail_not_same_base(void) may_throw; noreturn void xspan_fail_not_same_base() may_throw;
noreturn void xspan_fail_range_nullptr(void) may_throw; noreturn void xspan_fail_range_nullptr() may_throw;
noreturn void xspan_fail_range_nullbase(void) may_throw; noreturn void xspan_fail_range_nullbase() may_throw;
noreturn void xspan_fail_range_range(void) may_throw; noreturn void xspan_fail_range_range() may_throw;
void xspan_check_range(const void *ptr, const void *base, ptrdiff_t size_in_bytes) may_throw; void xspan_check_range(const void *ptr, const void *base, ptrdiff_t size_in_bytes) may_throw;
// help constructor to distinguish between number of elements and bytes // help constructor to distinguish between number of elements and bytes
+16 -13
View File
@@ -34,11 +34,6 @@ class CSelf {
#endif #endif
public: public:
typedef T element_type;
typedef typename std::add_lvalue_reference<T>::type reference;
typedef typename std::add_pointer<T>::type pointer;
typedef size_t size_type;
// befriend all // befriend all
template <class> template <class>
friend struct PtrOrSpan; friend struct PtrOrSpan;
@@ -47,6 +42,11 @@ public:
template <class> template <class>
friend struct Span; friend struct Span;
typedef T element_type;
typedef typename std::add_lvalue_reference<T>::type reference;
typedef typename std::add_pointer<T>::type pointer;
typedef size_t size_type;
#if XSPAN_CONFIG_ENABLE_IMPLICIT_CONVERSION #if XSPAN_CONFIG_ENABLE_IMPLICIT_CONVERSION
public: public:
operator pointer() const noexcept { return ptr; } operator pointer() const noexcept { return ptr; }
@@ -119,6 +119,7 @@ forceinline ~CSelf() noexcept {}
size_in_bytes = 0; size_in_bytes = 0;
assertInvariants(); assertInvariants();
} }
// constructors from pointers // constructors from pointers
CSelf(pointer first, XSpanCount count) CSelf(pointer first, XSpanCount count)
: ptr(makePtr(first)), base(makeBase(first)), : ptr(makePtr(first)), base(makeBase(first)),
@@ -171,12 +172,13 @@ forceinline ~CSelf() noexcept {}
// constructors from MemBuffer // constructors from MemBuffer
CSelf(MemBuffer &mb) CSelf(MemBuffer &mb)
: CSelf(makeNotNull((pointer) membuffer_get_void_ptr(mb)), : CSelf(makeNotNull((pointer) membuffer_get_void_ptr(mb)),
XSpanSizeInBytes(membuffer_get_size(mb))) {} XSpanSizeInBytes(membuffer_get_size_in_bytes(mb))) {}
CSelf(pointer first, MemBuffer &mb) CSelf(pointer first, MemBuffer &mb)
: CSelf(first, XSpanSizeInBytes(membuffer_get_size(mb)), : CSelf(first, XSpanSizeInBytes(membuffer_get_size_in_bytes(mb)),
makeNotNull((pointer) membuffer_get_void_ptr(mb))) {} makeNotNull((pointer) membuffer_get_void_ptr(mb))) {}
CSelf(std::nullptr_t, MemBuffer &) XSPAN_DELETED_FUNCTION; CSelf(std::nullptr_t, MemBuffer &) XSPAN_DELETED_FUNCTION;
#endif #endif
// disable constructors from nullptr to catch compile-time misuse // disable constructors from nullptr to catch compile-time misuse
private: private:
CSelf(std::nullptr_t, XSpanCount) XSPAN_DELETED_FUNCTION; CSelf(std::nullptr_t, XSpanCount) XSPAN_DELETED_FUNCTION;
@@ -404,7 +406,7 @@ public:
} }
private: private:
pointer check_deref(pointer p) const { pointer check_deref(pointer p) const may_throw {
assertInvariants(); assertInvariants();
if __acc_cte (!configRequirePtr && p == nullptr) if __acc_cte (!configRequirePtr && p == nullptr)
xspan_fail_nullptr(); xspan_fail_nullptr();
@@ -412,7 +414,7 @@ private:
xspan_check_range(p, base, size_in_bytes - sizeof(T)); xspan_check_range(p, base, size_in_bytes - sizeof(T));
return p; return p;
} }
pointer check_deref(pointer p, ptrdiff_t n) const { pointer check_deref(pointer p, ptrdiff_t n) const may_throw {
assertInvariants(); assertInvariants();
if __acc_cte (!configRequirePtr && p == nullptr) if __acc_cte (!configRequirePtr && p == nullptr)
xspan_fail_nullptr(); xspan_fail_nullptr();
@@ -422,7 +424,7 @@ private:
xspan_check_range(p, base, size_in_bytes - sizeof(T)); xspan_check_range(p, base, size_in_bytes - sizeof(T));
return p; return p;
} }
pointer check_add(pointer p, ptrdiff_t n) const { pointer check_add(pointer p, ptrdiff_t n) const may_throw {
assertInvariants(); assertInvariants();
if __acc_cte (!configRequirePtr && p == nullptr) if __acc_cte (!configRequirePtr && p == nullptr)
xspan_fail_nullptr(); xspan_fail_nullptr();
@@ -442,14 +444,15 @@ public: // raw access
pointer raw_base() const noexcept { return base; } pointer raw_base() const noexcept { return base; }
size_type raw_size_in_bytes() const noexcept { return size_in_bytes; } size_type raw_size_in_bytes() const noexcept { return size_in_bytes; }
pointer raw_bytes(size_t bytes) const { pointer raw_bytes(size_t bytes) const may_throw {
assertInvariants(); assertInvariants();
if (bytes > 0) { if (bytes > 0) {
if __acc_cte (!configRequirePtr && ptr == nullptr) if __acc_cte (!configRequirePtr && ptr == nullptr)
xspan_fail_nullptr(); xspan_fail_nullptr();
if __acc_cte (configRequireBase || base != nullptr) { if __acc_cte (configRequireBase || base != nullptr)
xspan_check_range(ptr, base, size_in_bytes - bytes); xspan_check_range(ptr, base, size_in_bytes - bytes);
} if very_unlikely (__acc_cte(VALGRIND_CHECK_MEM_IS_ADDRESSABLE(ptr, bytes) != 0))
throwCantPack("raw_bytes valgrind-check-mem");
} }
return ptr; return ptr;
} }
+9 -2
View File
@@ -80,6 +80,8 @@ public:
ptr_invalidate_and_poison(ptr); // point to non-null invalid address ptr_invalidate_and_poison(ptr); // point to non-null invalid address
assertInvariants(); assertInvariants();
} }
// inline CSelf() : ptr(nullptr) { invalidate(); }
inline CSelf() { assertInvariants(); } inline CSelf() { assertInvariants(); }
// constructors from pointers // constructors from pointers
@@ -132,7 +134,6 @@ public:
} }
// comparison // comparison
bool operator==(pointer other) const noexcept { return ptr == other; } bool operator==(pointer other) const noexcept { return ptr == other; }
template <class U> template <class U>
XSPAN_REQUIRES_CONVERTIBLE_R(bool) XSPAN_REQUIRES_CONVERTIBLE_R(bool)
@@ -201,14 +202,20 @@ private:
static forceinline pointer check_deref(pointer p, ptrdiff_t n) noexcept { return p + n; } static forceinline pointer check_deref(pointer p, ptrdiff_t n) noexcept { return p + n; }
static forceinline pointer check_add(pointer p, ptrdiff_t n) noexcept { return p + n; } static forceinline pointer check_add(pointer p, ptrdiff_t n) noexcept { return p + n; }
// disable taking the address => force passing by reference
// [I'm not too sure about this design decision, but we can always allow it if needed]
Self *operator&() const XSPAN_DELETED_FUNCTION;
public: // raw access public: // raw access
pointer raw_ptr() const noexcept { return ptr; } pointer raw_ptr() const noexcept { return ptr; }
pointer raw_bytes(size_t bytes) const { pointer raw_bytes(size_t bytes) const may_throw {
assertInvariants(); assertInvariants();
if (bytes > 0) { if (bytes > 0) {
if very_unlikely (ptr == nullptr) if very_unlikely (ptr == nullptr)
xspan_fail_nullptr(); xspan_fail_nullptr();
if very_unlikely (__acc_cte(VALGRIND_CHECK_MEM_IS_ADDRESSABLE(ptr, bytes) != 0))
throwCantPack("raw_bytes valgrind-check-mem");
} }
return ptr; return ptr;
} }
+5 -5
View File
@@ -1,7 +1,7 @@
#pragma once #pragma once
#define UPX_VERSION_HEX 0x050003 /* 05.00.03 */ #define UPX_VERSION_HEX 0x050100 /* 05.01.00 */
#define UPX_VERSION_STRING "5.0.3" #define UPX_VERSION_STRING "5.1.0"
#define UPX_VERSION_STRING4 "5.03" #define UPX_VERSION_STRING4 "5.10"
#define UPX_VERSION_DATE "Jul 21st 2025" #define UPX_VERSION_DATE "Oct 24th 2025"
#define UPX_VERSION_DATE_ISO "2025-07-21" #define UPX_VERSION_DATE_ISO "2025-10-24"
#define UPX_VERSION_YEAR "2025" #define UPX_VERSION_YEAR "2025"
+15 -13
View File
@@ -329,19 +329,21 @@ void do_one_file(const char *const iname, char *const oname) may_throw {
} }
// handle command - actual work starts HERE // handle command - actual work starts HERE
PackMaster pm(&fi, opt); {
if (opt->cmd == CMD_COMPRESS) PackMaster pm(&fi, opt);
pm.pack(&fo); if (opt->cmd == CMD_COMPRESS)
else if (opt->cmd == CMD_DECOMPRESS) pm.pack(&fo);
pm.unpack(&fo); else if (opt->cmd == CMD_DECOMPRESS)
else if (opt->cmd == CMD_TEST) pm.unpack(&fo);
pm.test(); else if (opt->cmd == CMD_TEST)
else if (opt->cmd == CMD_LIST) pm.test();
pm.list(); else if (opt->cmd == CMD_LIST)
else if (opt->cmd == CMD_FILEINFO) pm.list();
pm.fileInfo(); else if (opt->cmd == CMD_FILEINFO)
else pm.fileInfo();
throwInternalError("invalid command"); else
throwInternalError("invalid command");
}
// copy time stamp // copy time stamp
if (oname[0] && opt->preserve_timestamp && fo.isOpen()) if (oname[0] && opt->preserve_timestamp && fo.isOpen())