src: initialize some fields to suppress harmless valgrind errors

This commit is contained in:
Markus F.X.J. Oberhumer 2024-04-24 12:36:22 +02:00
parent 6db0af8d04
commit c69b4561fb
16 changed files with 124 additions and 103 deletions

View File

@ -24,8 +24,9 @@ if [[ 1 == 1 ]]; then
# INFO: SELinux users *may* have to add ":z" to the volume mount flags; check the docs! # INFO: SELinux users *may* have to add ":z" to the volume mount flags; check the docs!
flags+=( -v "${argv0dir}/../../..:/home/upx/src/upx" ) flags+=( -v "${argv0dir}/../../..:/home/upx/src/upx" )
flags+=( -w /home/upx/src/upx ) # set working directory flags+=( -w /home/upx/src/upx ) # set working directory
flags+=( --tmpfs /home/upx/.cache:rw,exec ) # mount a writeable tmpfs flags+=( --tmpfs /home/upx/.cache:rw,exec ) # mount a writeable tmpfs
flags+=( --tmpfs /home/upx/.local:rw,exec ) # mount a writeable tmpfs flags+=( --tmpfs /home/upx/.config:rw,exec ) # mount a writeable tmpfs
flags+=( --tmpfs /home/upx/.local:rw,exec ) # mount a writeable tmpfs
else else
# run as user root 0:0 # run as user root 0:0
# ONLY FOR DEBUGGING THE IMAGE # ONLY FOR DEBUGGING THE IMAGE

View File

@ -8,17 +8,19 @@ ENV LANG=C.UTF-8
RUN dpkg --add-architecture i386 \ 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 dash git less libmpc3 \ aria2 bash bash-completion ca-certificates curl git less libmpc3 \
make ncurses-term perl-base time wget xz-utils \ make ncurses-term perl-base tar time 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
# the full UPX binary inside the container via CMake: # the full UPX binary inside the container via CMake:
7zip bfs busybox bzip2 cabextract ccache chrpath cmake cpio curl elfutils fd-find file fish fzf \ 7zip bfs bubblewrap busybox bzip2 bzip3 cabextract ccache chrpath cmake cpio dash diffstat \
g++ gawk gdb gojq ht htop hyperfine jq ksh libzstd-dev lsb-release lz4 lzip lzop \ elfutils execstack fd-find file fish fzf g++ gawk gdb gojq ht htop hyperfine jq ksh \
minify mksh moreutils neovim ninja-build p7zip parallel patch patchelf patchutils pax-utils \ libzstd-dev lsb-release lz4 lzip lzop minify mksh moreutils musl neovim ninja-build \
p7zip parallel patch patchelf patchutils pax-utils proot \
python3 python3-pyasn1 python3-pycryptodome python3-zstd \ python3 python3-pyasn1 python3-pycryptodome python3-zstd \
re2c ripgrep rsync screen universal-ctags unzip yash yq zip zlib1g-dev zsh zstd \ re2c ripgrep rsync screen universal-ctags unzip yash yq \
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 \
&& true && true
@ -58,25 +60,36 @@ RUN cd /root \
# install official UPX release binaries into /usr/local/bin; not required but convenient for testing # install official UPX release binaries into /usr/local/bin; not required but convenient for testing
RUN cd /root \ RUN cd /root \
&& wget -q https://github.com/upx/upx/releases/download/v3.91/upx-3.91-amd64_linux.tar.bz2 \ && wget -q https://github.com/upx/upx/releases/download/v3.91/upx-3.91-amd64_linux.tar.bz2 \
&& xzlist="3.92 3.93 3.94 3.95 3.96 4.0.0 4.0.1 4.0.2 4.1.0 4.2.0 4.2.1 4.2.2 4.2.3" \ && xzversions="3.92 3.93 3.94 3.95 3.96 4.0.0 4.0.1 4.0.2 4.1.0 4.2.0 4.2.1 4.2.2 4.2.3" \
&& for v in $xzlist; do wget -q https://github.com/upx/upx/releases/download/v${v}/upx-${v}-amd64_linux.tar.xz; done \ && for v in $xzversions; do wget -q https://github.com/upx/upx/releases/download/v${v}/upx-${v}-amd64_linux.tar.xz; done \
&& for f in ./upx-*.tar.*; do tar -xoaf $f; done \ && for f in ./upx-*.tar.*; do tar -xoaf $f; done \
&& for v in 3.91 $xzlist; do d=upx-${v}-amd64_linux; ./$d/upx -qq -d $d/upx -o /usr/local/bin/upx-${v}; done \ && for v in 3.91 $xzversions; do d=upx-${v}-amd64_linux; ./$d/upx -qq -d $d/upx -o /usr/local/bin/upx-${v}; done \
&& rm -r ./upx-*.tar.* ./upx-*linux \ && rm -r ./upx-*.tar.* ./upx-*linux \
&& true && true
# create default user upx:upx 2000:2000 # create default container user upx:upx 2000:2000
RUN useradd upx -U --uid 2000 --shell /bin/bash -m \ RUN useradd upx -U --uid 2000 --shell /bin/bash -m \
&& cd /home/upx && chmod 00700 . \ && cd /home/upx && chmod 00700 . \
# prepare ~/.cache and ~/.local for possible tmpfs mounts # prepare ~/.cache, ~/.config and ~/.local for possible tmpfs mounts
&& mkdir -p .cache/tmp .local/bin src/upx \ && mkdir -p .cache/tmp .local/bin src/upx \
&& for d in ccache fontconfig go-build mesa_shader_cache tmp wine zig; do mkdir -p .cache/$d; done \ && for d in ccache fontconfig go-build mesa_shader_cache tmp wine zig; do mkdir -p .cache/$d; done \
&& for d in fish git helix kak nvim; do mkdir -p .config/$d; done \
&& for d in bin include lib share state; do mkdir -p .local/$d; done \ && for d in bin include lib share state; do mkdir -p .local/$d; done \
&& ln -s .cache/wine .wine && ln -s .cache/tmp tmp \ && ln -s .cache/wine .wine && ln -s .cache/tmp tmp \
# symlink upx-stubtools
&& ln -s /usr/local/bin/bin-upx-20221212 .local/bin/bin-upx \ && ln -s /usr/local/bin/bin-upx-20221212 .local/bin/bin-upx \
&& echo 'm() { make "$@"; }' >> .bash_aliases \ # some convenience settings according to upx developer preferences
&& echo 'source /usr/share/bash-completion/completions/make' >> .bash_aliases \ && echo "alias md=mkdir" >> .bashrc \
&& echo 'complete -F _make m' >> .bash_aliases \ && echo "alias rd=rmdir" >> .bashrc \
&& echo 'mdd() { mkdir "$1" && cd "$1"; }' >> .bashrc \
&& echo 'm() { make "$@"; }' >> .bashrc \
&& echo 'source /usr/share/bash-completion/completions/make' >> .bashrc \
&& echo 'complete -F _make m' >> .bashrc \
&& echo 'eval "$(zoxide init bash)"' >> .bashrc \
&& echo "alias zz=zi\nalias y=z\nalias yy=zi" >> .bashrc \
&& echo "alias cd..='cd ..'" >> .bashrc \
&& echo "alias ..='cd ..'" >> .bashrc \
&& echo "alias .='cd ..'" >> .bashrc \
&& chown -R upx:upx . \ && chown -R upx:upx . \
&& true && true
USER upx USER upx

View File

@ -4,7 +4,7 @@ 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.7.12 amd64 commandline package manager ii apt 2.7.12 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 13ubuntu9 amd64 Debian base system miscellaneous files ii base-files 13ubuntu10 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
@ -12,10 +12,12 @@ ii bfs 3.1.2-1build1 amd64
ii binutils 2.42-4ubuntu2 amd64 GNU assembler, linker and binary utilities ii binutils 2.42-4ubuntu2 amd64 GNU assembler, linker and binary utilities
ii binutils-common:amd64 2.42-4ubuntu2 amd64 Common files for the GNU assembler, linker and binary utilities ii binutils-common:amd64 2.42-4ubuntu2 amd64 Common files for the GNU assembler, linker and binary utilities
ii binutils-x86-64-linux-gnu 2.42-4ubuntu2 amd64 GNU binary utilities, for x86-64-linux-gnu target ii binutils-x86-64-linux-gnu 2.42-4ubuntu2 amd64 GNU binary utilities, for x86-64-linux-gnu target
ii bsdextrautils 2.39.3-9ubuntu4 amd64 extra utilities from 4.4BSD-Lite ii bsdextrautils 2.39.3-9ubuntu6 amd64 extra utilities from 4.4BSD-Lite
ii bsdutils 1:2.39.3-9ubuntu4 amd64 basic utilities from 4.4BSD-Lite ii bsdutils 1:2.39.3-9ubuntu6 amd64 basic utilities from 4.4BSD-Lite
ii busybox 1:1.36.1-6ubuntu1 amd64 Tiny utilities for small and embedded systems ii bubblewrap 0.9.0-1build1 amd64 utility for unprivileged chroot and namespace manipulation
ii busybox 1:1.36.1-6ubuntu3 amd64 Tiny utilities for small and embedded systems
ii bzip2 1.0.8-5.1 amd64 high-quality block-sorting file compressor - utilities ii bzip2 1.0.8-5.1 amd64 high-quality block-sorting file compressor - utilities
ii bzip3 1.4.0-1 amd64 better, faster and stronger spiritual successor to bzip2 - utilities
ii ca-certificates 20240203 all Common CA certificates ii ca-certificates 20240203 all Common CA certificates
ii cabextract 1.11-2 amd64 Microsoft Cabinet file unpacker ii cabextract 1.11-2 amd64 Microsoft Cabinet file unpacker
ii ccache 4.9.1-1 amd64 Compiler cache for fast recompilation of C/C++ code ii ccache 4.9.1-1 amd64 Compiler cache for fast recompilation of C/C++ code
@ -32,10 +34,12 @@ ii curl 8.5.0-2ubuntu10 amd64
ii dash 0.5.12-6ubuntu5 amd64 POSIX-compliant shell ii dash 0.5.12-6ubuntu5 amd64 POSIX-compliant shell
ii debconf 1.5.86ubuntu1 all Debian configuration management system ii debconf 1.5.86ubuntu1 all Debian configuration management system
ii debianutils 5.17build1 amd64 Miscellaneous utilities specific to Debian ii debianutils 5.17build1 amd64 Miscellaneous utilities specific to Debian
ii diffstat 1.66-1build1 amd64 produces graph of changes introduced by a diff file
ii diffutils 1:3.10-1build1 amd64 File comparison utilities ii diffutils 1:3.10-1build1 amd64 File comparison utilities
ii dpkg 1.22.6ubuntu6 amd64 Debian package management system ii dpkg 1.22.6ubuntu6 amd64 Debian package management system
ii e2fsprogs 1.47.0-2.4~exp1ubuntu4 amd64 ext2/ext3/ext4 file system utilities ii e2fsprogs 1.47.0-2.4~exp1ubuntu4 amd64 ext2/ext3/ext4 file system utilities
ii elfutils 0.190-1.1build4 amd64 collection of utilities to handle ELF objects ii elfutils 0.190-1.1build4 amd64 collection of utilities to handle ELF objects
ii execstack 0.0.20131005-1.1ubuntu1 amd64 ELF GNU_STACK program header editing utility
ii fd-find 9.0.0-1 amd64 Simple, fast and user-friendly alternative to find ii fd-find 9.0.0-1 amd64 Simple, fast and user-friendly alternative to find
ii file 1:5.45-3build1 amd64 Recognize the type of data in a file using "magic" numbers ii file 1:5.45-3build1 amd64 Recognize the type of data in a file using "magic" numbers
ii findutils 4.9.0-5build1 amd64 utilities for finding files--find, xargs ii findutils 4.9.0-5build1 amd64 utilities for finding files--find, xargs
@ -98,10 +102,11 @@ ii libaudit-common 1:3.1.2-2.1build1 all
ii libaudit1:amd64 1:3.1.2-2.1build1 amd64 Dynamic library for security auditing ii libaudit1:amd64 1:3.1.2-2.1build1 amd64 Dynamic library for security auditing
ii libbabeltrace1:amd64 1.5.11-3build3 amd64 Babeltrace conversion libraries ii libbabeltrace1:amd64 1.5.11-3build3 amd64 Babeltrace conversion libraries
ii libbinutils:amd64 2.42-4ubuntu2 amd64 GNU binary utilities (private shared library) ii libbinutils:amd64 2.42-4ubuntu2 amd64 GNU binary utilities (private shared library)
ii libblkid1:amd64 2.39.3-9ubuntu4 amd64 block device ID library ii libblkid1:amd64 2.39.3-9ubuntu6 amd64 block device ID library
ii libbrotli1:amd64 1.1.0-2build2 amd64 library implementing brotli encoder and decoder (shared libraries) ii libbrotli1:amd64 1.1.0-2build2 amd64 library implementing brotli encoder and decoder (shared libraries)
ii libbsd0:amd64 0.12.1-1build1 amd64 utility functions from BSD systems - shared library ii libbsd0:amd64 0.12.1-1build1 amd64 utility functions from BSD systems - shared library
ii libbz2-1.0:amd64 1.0.8-5.1 amd64 high-quality block-sorting file compressor library - runtime ii libbz2-1.0:amd64 1.0.8-5.1 amd64 high-quality block-sorting file compressor library - runtime
ii libbzip3-0:amd64 1.4.0-1 amd64 better, faster and stronger spiritual successor to bzip2 - runtime
ii libc-bin 2.39-0ubuntu8 amd64 GNU C Library: Binaries ii libc-bin 2.39-0ubuntu8 amd64 GNU C Library: Binaries
ii libc-dev-bin 2.39-0ubuntu8 amd64 GNU C Library: Development binaries ii libc-dev-bin 2.39-0ubuntu8 amd64 GNU C Library: Development binaries
ii libc6-dev-i386 2.39-0ubuntu8 amd64 GNU C Library: 32-bit development libraries for AMD64 ii libc6-dev-i386 2.39-0ubuntu8 amd64 GNU C Library: 32-bit development libraries for AMD64
@ -172,10 +177,10 @@ ii liblzo2-2:amd64 2.10-2build4 amd64
ii libmagic-mgc 1:5.45-3build1 amd64 File type determination library using "magic" numbers (compiled magic file) ii libmagic-mgc 1:5.45-3build1 amd64 File type determination library using "magic" numbers (compiled magic file)
ii libmagic1t64:amd64 1:5.45-3build1 amd64 Recognize the type of data in a file using "magic" numbers - library ii libmagic1t64:amd64 1:5.45-3build1 amd64 Recognize the type of data in a file using "magic" numbers - library
ii libmd0:amd64 1.1.0-2build1 amd64 message digest functions from BSD systems - shared library ii libmd0:amd64 1.1.0-2build1 amd64 message digest functions from BSD systems - shared library
ii libmount1:amd64 2.39.3-9ubuntu4 amd64 device mounting library ii libmount1:amd64 2.39.3-9ubuntu6 amd64 device mounting library
ii libmpc3:amd64 1.3.1-1build1 amd64 multiple precision complex floating-point library ii libmpc3:amd64 1.3.1-1build1 amd64 multiple precision complex floating-point library
ii libmpfr6:amd64 4.2.1-1build1 amd64 multiple precision floating-point computation ii libmpfr6:amd64 4.2.1-1build1 amd64 multiple precision floating-point computation
ii libmsgpackc2:amd64 4.0.0-3 amd64 binary-based efficient object serialization library ii libmsgpackc2:amd64 4.0.0-3build1 amd64 binary-based efficient object serialization library
ii libmspack0t64:amd64 0.11-1.1build1 amd64 library for Microsoft compression formats (shared library) ii libmspack0t64:amd64 0.11-1.1build1 amd64 library for Microsoft compression formats (shared library)
ii libncurses6:amd64 6.4+20240113-1ubuntu2 amd64 shared libraries for terminal handling ii libncurses6:amd64 6.4+20240113-1ubuntu2 amd64 shared libraries for terminal handling
ii libncursesw6:amd64 6.4+20240113-1ubuntu2 amd64 shared libraries for terminal handling (wide character support) ii libncursesw6:amd64 6.4+20240113-1ubuntu2 amd64 shared libraries for terminal handling (wide character support)
@ -217,7 +222,7 @@ ii libsensors5:amd64 1:3.6.0-9build1 amd64
ii libsepol2:amd64 3.5-2build1 amd64 SELinux library for manipulating binary security policies ii libsepol2:amd64 3.5-2build1 amd64 SELinux library for manipulating binary security policies
ii libsframe1:amd64 2.42-4ubuntu2 amd64 Library to handle the SFrame format (runtime library) ii libsframe1:amd64 2.42-4ubuntu2 amd64 Library to handle the SFrame format (runtime library)
ii libsigsegv2:amd64 2.14-1ubuntu2 amd64 Library for handling page faults in a portable way ii libsigsegv2:amd64 2.14-1ubuntu2 amd64 Library for handling page faults in a portable way
ii libsmartcols1:amd64 2.39.3-9ubuntu4 amd64 smart column output alignment library ii libsmartcols1:amd64 2.39.3-9ubuntu6 amd64 smart column output alignment library
ii libsource-highlight-common 3.1.9-4.3build1 all architecture-independent files for source highlighting library ii libsource-highlight-common 3.1.9-4.3build1 all architecture-independent files for source highlighting library
ii libsource-highlight4t64:amd64 3.1.9-4.3build1 amd64 source highlighting library ii libsource-highlight4t64:amd64 3.1.9-4.3build1 amd64 source highlighting library
ii libsqlite3-0:amd64 3.45.1-1ubuntu2 amd64 SQLite 3 shared library ii libsqlite3-0:amd64 3.45.1-1ubuntu2 amd64 SQLite 3 shared library
@ -227,7 +232,8 @@ ii libssh2-1t64:amd64 1.11.0-4.1build2 amd64
ii libssl3t64:amd64 3.0.13-0ubuntu3 amd64 Secure Sockets Layer toolkit - shared libraries ii libssl3t64:amd64 3.0.13-0ubuntu3 amd64 Secure Sockets Layer toolkit - shared libraries
ii libstdc++-13-dev:amd64 13.2.0-23ubuntu4 amd64 GNU Standard C++ Library v3 (development files) ii libstdc++-13-dev:amd64 13.2.0-23ubuntu4 amd64 GNU Standard C++ Library v3 (development files)
ii libstdc++6:amd64 14-20240412-0ubuntu1 amd64 GNU Standard C++ Library v3 ii libstdc++6:amd64 14-20240412-0ubuntu1 amd64 GNU Standard C++ Library v3
ii libsystemd0:amd64 255.4-1ubuntu7 amd64 systemd utility library ii libsystemd0:amd64 255.4-1ubuntu8 amd64 systemd utility library
ii libtalloc2:amd64 2.4.2-1build2 amd64 hierarchical pool based memory allocator
ii libtasn1-6:amd64 4.19.0-3build1 amd64 Manage ASN.1 structures (runtime) ii libtasn1-6:amd64 4.19.0-3build1 amd64 Manage ASN.1 structures (runtime)
ii libtermkey1:amd64 0.22-1 amd64 library for processing keyboard input ii libtermkey1:amd64 0.22-1 amd64 library for processing keyboard input
ii libtime-duration-perl 1.21-2 all module for rounded or exact English expression of durations ii libtime-duration-perl 1.21-2 all module for rounded or exact English expression of durations
@ -237,12 +243,12 @@ ii libtree-sitter0:amd64 0.20.8-2 amd64
ii libtsan2:amd64 14-20240412-0ubuntu1 amd64 ThreadSanitizer -- a Valgrind-based detector of data races (runtime) ii libtsan2:amd64 14-20240412-0ubuntu1 amd64 ThreadSanitizer -- a Valgrind-based detector of data races (runtime)
ii libubsan1:amd64 14-20240412-0ubuntu1 amd64 UBSan -- undefined behaviour sanitizer (runtime) ii libubsan1:amd64 14-20240412-0ubuntu1 amd64 UBSan -- undefined behaviour sanitizer (runtime)
ii libuchardet0:amd64 0.0.8-1build1 amd64 universal charset detection library - shared library ii libuchardet0:amd64 0.0.8-1build1 amd64 universal charset detection library - shared library
ii libudev1:amd64 255.4-1ubuntu7 amd64 libudev shared library ii libudev1:amd64 255.4-1ubuntu8 amd64 libudev shared library
ii libunibilium4:amd64 2.1.0-3 amd64 simple, self-contained terminfo library ii libunibilium4:amd64 2.1.0-3 amd64 simple, self-contained terminfo library
ii libunistring5:amd64 1.1-2build1 amd64 Unicode string library for C ii libunistring5:amd64 1.1-2build1 amd64 Unicode string library for C
ii liburing2:amd64 2.5-1build1 amd64 Linux kernel io_uring access library - shared library ii liburing2:amd64 2.5-1build1 amd64 Linux kernel io_uring access library - shared library
ii libutempter0:amd64 1.2.1-3build1 amd64 privileged helper for utmp/wtmp updates (runtime) ii libutempter0:amd64 1.2.1-3build1 amd64 privileged helper for utmp/wtmp updates (runtime)
ii libuuid1:amd64 2.39.3-9ubuntu4 amd64 Universally Unique ID library ii libuuid1:amd64 2.39.3-9ubuntu6 amd64 Universally Unique ID library
ii libuv1t64:amd64 1.48.0-1.1build1 amd64 asynchronous event notification library - runtime library ii libuv1t64:amd64 1.48.0-1.1build1 amd64 asynchronous event notification library - runtime library
ii libvterm0:amd64 0.3.3-2build1 amd64 abstract terminal library ii libvterm0:amd64 0.3.3-2build1 amd64 abstract terminal library
ii libx11-6:amd64 2:1.8.7-1build1 amd64 X11 client-side library ii libx11-6:amd64 2:1.8.7-1build1 amd64 X11 client-side library
@ -258,14 +264,14 @@ ii libx32stdc++-13-dev 13.2.0-23ubuntu4 amd64
ii libx32stdc++6 14-20240412-0ubuntu1 amd64 GNU Standard C++ Library v3 (x32) ii libx32stdc++6 14-20240412-0ubuntu1 amd64 GNU Standard C++ Library v3 (x32)
ii libx32ubsan1 14-20240412-0ubuntu1 amd64 UBSan -- undefined behaviour sanitizer (x32) ii libx32ubsan1 14-20240412-0ubuntu1 amd64 UBSan -- undefined behaviour sanitizer (x32)
ii libxau6:amd64 1:1.0.9-1build6 amd64 X11 authorisation library ii libxau6:amd64 1:1.0.9-1build6 amd64 X11 authorisation library
ii libxcb1:amd64 1.15-1 amd64 X C Binding ii libxcb1:amd64 1.15-1ubuntu2 amd64 X C Binding
ii libxdmcp6:amd64 1:1.1.3-0ubuntu6 amd64 X11 Display Manager Control Protocol library ii libxdmcp6:amd64 1:1.1.3-0ubuntu6 amd64 X11 Display Manager Control Protocol library
ii libxml2:amd64 2.9.14+dfsg-1.3ubuntu3 amd64 GNOME XML library ii libxml2:amd64 2.9.14+dfsg-1.3ubuntu3 amd64 GNOME XML library
ii libxxhash0:amd64 0.8.2-2build1 amd64 shared library for xxhash ii libxxhash0:amd64 0.8.2-2build1 amd64 shared library for xxhash
ii libyaml-0-2:amd64 0.2.5-1build1 amd64 Fast YAML 1.1 parser and emitter library ii libyaml-0-2:amd64 0.2.5-1build1 amd64 Fast YAML 1.1 parser and emitter library
ii libzstd-dev:amd64 1.5.5+dfsg2-2build1 amd64 fast lossless compression algorithm -- development files ii libzstd-dev:amd64 1.5.5+dfsg2-2build1 amd64 fast lossless compression algorithm -- development files
ii libzstd1:amd64 1.5.5+dfsg2-2build1 amd64 fast lossless compression algorithm ii libzstd1:amd64 1.5.5+dfsg2-2build1 amd64 fast lossless compression algorithm
ii linux-libc-dev:amd64 6.8.0-28.28 amd64 Linux Kernel Headers for development ii linux-libc-dev:amd64 6.8.0-31.31 amd64 Linux Kernel Headers for development
ii login 1:4.13+dfsg1-4ubuntu3 amd64 system login tools ii login 1:4.13+dfsg1-4ubuntu3 amd64 system login tools
ii logsave 1.47.0-2.4~exp1ubuntu4 amd64 save the output of a command in a log file ii logsave 1.47.0-2.4~exp1ubuntu4 amd64 save the output of a command in a log file
ii lsb-release 12.0-2 all Linux Standard Base version reporting utility (minimal implementation) ii lsb-release 12.0-2 all Linux Standard Base version reporting utility (minimal implementation)
@ -280,7 +286,8 @@ ii media-types 10.1.0 all
ii minify 2.20.17-1 amd64 CLI implementation of the Go minify library package ii minify 2.20.17-1 amd64 CLI implementation of the Go minify library package
ii mksh 59c-37 amd64 MirBSD Korn Shell ii mksh 59c-37 amd64 MirBSD Korn Shell
ii moreutils 0.69-1 amd64 additional Unix utilities ii moreutils 0.69-1 amd64 additional Unix utilities
ii mount 2.39.3-9ubuntu4 amd64 tools for mounting and manipulating filesystems ii mount 2.39.3-9ubuntu6 amd64 tools for mounting and manipulating filesystems
ii musl:amd64 1.2.4-2 amd64 standard C library
ii ncurses-base 6.4+20240113-1ubuntu2 all basic terminal type definitions ii ncurses-base 6.4+20240113-1ubuntu2 all basic terminal type definitions
ii ncurses-bin 6.4+20240113-1ubuntu2 amd64 terminal-related programs and man pages ii ncurses-bin 6.4+20240113-1ubuntu2 amd64 terminal-related programs and man pages
ii ncurses-term 6.4+20240113-1ubuntu2 all additional terminal type definitions ii ncurses-term 6.4+20240113-1ubuntu2 all additional terminal type definitions
@ -300,6 +307,7 @@ ii perl 5.38.2-3.2build2 amd64
ii perl-base 5.38.2-3.2build2 amd64 minimal Perl system ii perl-base 5.38.2-3.2build2 amd64 minimal Perl system
ii perl-modules-5.38 5.38.2-3.2build2 all Core Perl modules ii perl-modules-5.38 5.38.2-3.2build2 all Core Perl modules
ii procps 2:4.0.4-4ubuntu3 amd64 /proc file system utilities ii procps 2:4.0.4-4ubuntu3 amd64 /proc file system utilities
ii proot 5.1.0-1.3 amd64 emulate chroot, bind mount and binfmt_misc for non-root users
ii python2.7-minimal 2.7.18-8+deb11u1 amd64 Minimal subset of the Python language (version 2.7) ii python2.7-minimal 2.7.18-8+deb11u1 amd64 Minimal subset of the Python language (version 2.7)
ii python3 3.12.3-0ubuntu1 amd64 interactive high-level object-oriented language (default python3 version) ii python3 3.12.3-0ubuntu1 amd64 interactive high-level object-oriented language (default python3 version)
ii python3-argcomplete 3.1.4-1 all bash tab completion for argparse (for Python 3) ii python3-argcomplete 3.1.4-1 all bash tab completion for argparse (for Python 3)
@ -330,7 +338,7 @@ ii ubuntu-keyring 2023.11.28.1 all
ii ucf 3.0043+nmu1 all Update Configuration File(s): preserve user changes to config files 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 universal-ctags 5.9.20210829.0-1 amd64 build tag file indexes of source code definitions
ii unzip 6.0-28ubuntu4 amd64 De-archiver for .zip files ii unzip 6.0-28ubuntu4 amd64 De-archiver for .zip files
ii util-linux 2.39.3-9ubuntu4 amd64 miscellaneous system utilities ii util-linux 2.39.3-9ubuntu6 amd64 miscellaneous system utilities
ii wget 1.21.4-1ubuntu4 amd64 retrieves files from the web ii wget 1.21.4-1ubuntu4 amd64 retrieves files from the web
ii xz-utils 5.6.1+really5.4.5-1 amd64 XZ-format compression utilities ii xz-utils 5.6.1+really5.4.5-1 amd64 XZ-format compression utilities
ii yash 2.55-2 amd64 yet another shell ii yash 2.55-2 amd64 yet another shell
@ -339,6 +347,7 @@ ii zip 3.0-13build1 amd64
ii zlib1g-dev:amd64 1:1.3.dfsg-3.1ubuntu2 amd64 compression library - development ii zlib1g-dev:amd64 1:1.3.dfsg-3.1ubuntu2 amd64 compression library - development
ii zlib1g:amd64 1:1.3.dfsg-3.1ubuntu2 amd64 compression library - runtime ii zlib1g:amd64 1:1.3.dfsg-3.1ubuntu2 amd64 compression library - runtime
ii zlib1g:i386 1:1.3.dfsg-3.1ubuntu2 i386 compression library - runtime ii zlib1g:i386 1:1.3.dfsg-3.1ubuntu2 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 5.9-6ubuntu2 amd64 shell with lots of features
ii zsh-common 5.9-6ubuntu2 all architecture independent files for Zsh ii zsh-common 5.9-6ubuntu2 all architecture independent files for Zsh
ii zstd 1.5.5+dfsg2-2build1 amd64 fast lossless compression algorithm -- CLI tool ii zstd 1.5.5+dfsg2-2build1 amd64 fast lossless compression algorithm -- CLI tool
@ -348,7 +357,7 @@ rc libgnutls30:amd64 3.8.3-1ubuntu1 amd64
||/ Name Version Architecture Description ||/ Name Version Architecture Description
Packages sorted by Installed-Size: Packages sorted by Installed-Size:
873594 ===== TOTAL (342 packages) 876372 ===== TOTAL (351 packages)
72249 gcc-13-x86-64-linux-gnu amd64 72249 gcc-13-x86-64-linux-gnu amd64
37841 g++-13-x86-64-linux-gnu amd64 37841 g++-13-x86-64-linux-gnu amd64
36493 cmake amd64 36493 cmake amd64
@ -382,7 +391,7 @@ Packages sorted by Installed-Size:
7923 python3.12-minimal amd64 7923 python3.12-minimal amd64
7913 perl-base amd64 7913 perl-base amd64
7492 libx32gcc-13-dev amd64 7492 libx32gcc-13-dev amd64
7165 linux-libc-dev amd64 7166 linux-libc-dev amd64
6946 libc6-dev-i386 amd64 6946 libc6-dev-i386 amd64
6944 coreutils amd64 6944 coreutils amd64
6775 neovim amd64 6775 neovim amd64
@ -407,7 +416,7 @@ Packages sorted by Installed-Size:
3605 python2.7-minimal amd64 3605 python2.7-minimal amd64
3443 fish amd64 3443 fish amd64
3441 re2c amd64 3441 re2c amd64
3437 util-linux amd64 3438 util-linux amd64
3403 libaria2-0 amd64 3403 libaria2-0 amd64
3382 fd-find amd64 3382 fd-find amd64
3349 libubsan1 amd64 3349 libubsan1 amd64
@ -457,8 +466,9 @@ Packages sorted by Installed-Size:
1314 hyperfine amd64 1314 hyperfine amd64
1237 libzstd-dev amd64 1237 libzstd-dev amd64
1186 libmpfr6 amd64 1186 libmpfr6 amd64
1136 zoxide amd64
1123 libpam-modules amd64 1123 libpam-modules amd64
1024 libsystemd0 amd64 1025 libsystemd0 amd64
1014 libkrb5-3 amd64 1014 libkrb5-3 amd64
996 screen amd64 996 screen amd64
924 libcurl4t64 amd64 924 libcurl4t64 amd64
@ -466,9 +476,10 @@ Packages sorted by Installed-Size:
905 libcurl3t64-gnutls amd64 905 libcurl3t64-gnutls amd64
904 libarchive13t64 amd64 904 libarchive13t64 amd64
884 login amd64 884 login amd64
852 busybox amd64
843 libbrotli1 amd64 843 libbrotli1 amd64
828 busybox amd64
812 lua-luv amd64 812 lua-luv amd64
785 musl amd64
780 rsync amd64 780 rsync amd64
765 libdw1t64 amd64 765 libdw1t64 amd64
761 libzstd1 amd64 761 libzstd1 amd64
@ -515,12 +526,12 @@ Packages sorted by Installed-Size:
375 unzip amd64 375 unzip amd64
374 lib32gomp1 amd64 374 lib32gomp1 amd64
372 libgomp1 amd64 372 libgomp1 amd64
366 libmount1 amd64 367 libmount1 amd64
358 libjq1 amd64 358 libjq1 amd64
357 bfs amd64 357 bfs amd64
355 ninja-build amd64 355 ninja-build amd64
351 libx32gomp1 amd64 351 libx32gomp1 amd64
347 mount amd64 348 mount amd64
344 libcrypt-dev amd64 344 libcrypt-dev amd64
344 grep amd64 344 grep amd64
340 sed amd64 340 sed amd64
@ -528,16 +539,16 @@ Packages sorted by Installed-Size:
336 libncurses6 amd64 336 libncurses6 amd64
332 gpgv amd64 332 gpgv amd64
328 cpio amd64 328 cpio amd64
313 libudev1 amd64 314 libudev1 amd64
310 libctf-nobfd0 amd64 310 libctf-nobfd0 amd64
309 less amd64 309 less amd64
305 libsource-highlight-common all 305 libsource-highlight-common all
300 libquadmath0 amd64 300 libquadmath0 amd64
299 libx32quadmath0 amd64 299 libx32quadmath0 amd64
289 libblkid1 amd64
288 libsemanage2 amd64 288 libsemanage2 amd64
288 libblkid1 amd64 288 bsdutils amd64
287 bsdutils amd64 287 bsdextrautils amd64
286 bsdextrautils amd64
276 libpam-runtime all 276 libpam-runtime all
273 patchelf amd64 273 patchelf amd64
273 mawk amd64 273 mawk amd64
@ -567,18 +578,20 @@ Packages sorted by Installed-Size:
211 libmagic1t64 amd64 211 libmagic1t64 amd64
208 libpam0g amd64 208 libpam0g amd64
207 libuchardet0 amd64 207 libuchardet0 amd64
206 libxcb1 amd64 206 proot amd64
200 libselinux1 amd64 200 libselinux1 amd64
200 libnghttp2-14 amd64 200 libnghttp2-14 amd64
199 execstack amd64
198 libtree-sitter0 amd64 198 libtree-sitter0 amd64
197 libgcc-s1 amd64 197 libgcc-s1 amd64
196 libxcb1 amd64
196 libelf1t64 amd64 196 libelf1t64 amd64
187 dash amd64 187 dash amd64
185 libgpg-error0 amd64 185 libgpg-error0 amd64
184 libx32gcc-s1 amd64 184 libx32gcc-s1 amd64
176 libcares2 amd64 176 libcares2 amd64
172 libnl-3-200 amd64 172 libnl-3-200 amd64
170 libsmartcols1 amd64 171 libsmartcols1 amd64
163 lzip amd64 163 lzip amd64
162 zlib1g amd64 162 zlib1g amd64
159 binutils amd64 159 binutils amd64
@ -598,6 +611,7 @@ Packages sorted by Installed-Size:
132 libkrb5support0 amd64 132 libkrb5support0 amd64
131 libipt2 amd64 131 libipt2 amd64
130 init-system-helpers all 130 init-system-helpers all
129 bubblewrap amd64
127 libbsd0 amd64 127 libbsd0 amd64
126 time amd64 126 time amd64
126 libsframe1 amd64 126 libsframe1 amd64
@ -628,9 +642,11 @@ Packages sorted by Installed-Size:
93 libvterm0 amd64 93 libvterm0 amd64
93 libgdbm6t64 amd64 93 libgdbm6t64 amd64
90 libxxhash0 amd64 90 libxxhash0 amd64
83 libuuid1 amd64 84 libuuid1 amd64
83 libtalloc2 amd64
82 python3 amd64 82 python3 amd64
82 cabextract amd64 82 cabextract amd64
81 libbzip3-0 amd64
79 libsensors5 amd64 79 libsensors5 amd64
79 libmd0 amd64 79 libmd0 amd64
77 readline-common all 77 readline-common all
@ -639,11 +655,13 @@ Packages sorted by Installed-Size:
74 libasm1t64 amd64 74 libasm1t64 amd64
74 libacl1 amd64 74 libacl1 amd64
72 libffi8 amd64 72 libffi8 amd64
72 diffstat amd64
69 yq all 69 yq all
69 libss2 amd64 69 libss2 amd64
69 liberror-perl all 69 liberror-perl all
69 libdebuginfod1t64 amd64 69 libdebuginfod1t64 amd64
67 libpipeline1 amd64 67 libpipeline1 amd64
66 bzip3 amd64
63 sensible-utils all 63 sensible-utils all
63 libtermkey1 amd64 63 libtermkey1 amd64
63 file amd64 63 file amd64
@ -652,10 +670,10 @@ Packages sorted by Installed-Size:
60 libattr1 amd64 60 libattr1 amd64
57 libcom-err2 amd64 57 libcom-err2 amd64
53 libnl-genl-3-200 amd64 53 libnl-genl-3-200 amd64
52 libmsgpackc2 amd64
51 logsave amd64 51 logsave amd64
51 libutempter0 amd64 51 libutempter0 amd64
50 libdebuginfod-common all 50 libdebuginfod-common all
48 libmsgpackc2 amd64
47 python3-xmltodict all 47 python3-xmltodict all
47 libsigsegv2 amd64 47 libsigsegv2 amd64
46 hostname amd64 46 hostname amd64

View File

@ -180,7 +180,7 @@ typedef upx_int64_t upx_off_t;
#if defined(__clang__) || defined(__GNUC__) #if defined(__clang__) || defined(__GNUC__)
#define noreturn noinline __attribute__((__noreturn__)) #define noreturn noinline __attribute__((__noreturn__))
#elif (ACC_CC_MSC) #elif (ACC_CC_MSC)
// do not use, generates annoying "warning C4702: unreachable code" // do not use, triggers annoying "warning C4702: unreachable code"
////#define noreturn noinline __declspec(noreturn) ////#define noreturn noinline __declspec(noreturn)
#define noreturn noinline #define noreturn noinline
#else #else
@ -458,7 +458,7 @@ noreturn void throwAssertFailed(const char *expr, const char *file, int line, co
#if defined(__clang__) || defined(__GNUC__) #if defined(__clang__) || defined(__GNUC__)
#undef assert #undef assert
#if DEBUG || 0 #if DEBUG || 0
// generate a warning if assert() is used inside a "noexcept" context // trigger a warning if assert() is used inside a "noexcept" context
#define assert(e) \ #define assert(e) \
((void) (__acc_cte(e) || (assertFailed(#e, __FILE__, __LINE__, __func__), throw 1, 0))) ((void) (__acc_cte(e) || (assertFailed(#e, __FILE__, __LINE__, __func__), throw 1, 0)))
#else #else
@ -707,7 +707,7 @@ struct upx_compress_config_t final {
} }
}; };
#define NULL_cconf ((upx_compress_config_t *) nullptr) #define NULL_cconf ((const upx_compress_config_t *) nullptr)
/************************************************************************* /*************************************************************************
// compression - result_t // compression - result_t

View File

@ -190,8 +190,7 @@ protected:
unsigned le_offset = 0; unsigned le_offset = 0;
unsigned exe_offset = 0; unsigned exe_offset = 0;
le_header_t ih; le_header_t ih = {}, oh = {};
le_header_t oh;
le_object_table_entry_t *iobject_table = nullptr; le_object_table_entry_t *iobject_table = nullptr;
le_object_table_entry_t *oobject_table = nullptr; le_object_table_entry_t *oobject_table = nullptr;

View File

@ -1364,11 +1364,7 @@ int __acc_cdecl_main main(int argc, char *argv[]) /*noexcept*/ {
_set_abort_behavior(_WRITE_ABORT_MSG, _WRITE_ABORT_MSG | _CALL_REPORTFAULT); _set_abort_behavior(_WRITE_ABORT_MSG, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
#endif #endif
acc_wildargv(&argc, &argv); acc_wildargv(&argc, &argv);
#if defined(__wasi__) upx_rand_init();
::srand((unsigned) time(nullptr));
#else
::srand((unsigned) clock());
#endif
// info: main() is implicitly "noexcept", so we need a try block // info: main() is implicitly "noexcept", so we need a try block
#if 0 #if 0

View File

@ -86,7 +86,7 @@ protected:
LE32 firstreloc; LE32 firstreloc;
}; };
exe_header_t ih, oh; exe_header_t ih = {}, oh = {};
unsigned ih_exesize = 0; unsigned ih_exesize = 0;
unsigned ih_imagesize = 0; unsigned ih_imagesize = 0;

View File

@ -75,9 +75,7 @@ static const CLANG_FORMAT_DUMMY_STATEMENT
**************************************************************************/ **************************************************************************/
PackPs1::PackPs1(InputFile *f) PackPs1::PackPs1(InputFile *f)
: super(f), isCon(!opt->ps1_exe.boot_only), is32Bit(!opt->ps1_exe.do_8bit), buildPart2(0), : super(f), isCon(!opt->ps1_exe.boot_only), is32Bit(!opt->ps1_exe.do_8bit) {
foundBss(0), sa_cnt(0), overlap(0), sz_lunc(0), sz_lcpr(0), pad_code(0), bss_start(0),
bss_end(0) {
bele = &N_BELE_RTP::le_policy; bele = &N_BELE_RTP::le_policy;
COMPILE_TIME_ASSERT(sizeof(ps1_exe_t) == 136) COMPILE_TIME_ASSERT(sizeof(ps1_exe_t) == 136)

View File

@ -108,20 +108,20 @@ protected:
LE16 hi2, op3, lo2, op4; LE16 hi2, op3, lo2, op4;
}; };
ps1_exe_t ih, oh; ps1_exe_t ih = {}, oh = {};
ps1_exe_hb_t bh; ps1_exe_hb_t bh = {};
bool isCon; bool isCon = false;
bool is32Bit; bool is32Bit = false;
bool buildPart2; bool buildPart2 = false;
bool foundBss; bool foundBss = false;
unsigned ram_size; unsigned ram_size = 0;
unsigned sa_cnt, overlap; unsigned sa_cnt = 0, overlap = 0;
unsigned sz_lunc, sz_lcpr; unsigned sz_lunc = 0, sz_lcpr = 0;
unsigned pad_code; unsigned pad_code = 0;
unsigned bss_start, bss_end; unsigned bss_start = 0, bss_end = 0;
// filesize-PS_HDR_SIZE // filesize-PS_HDR_SIZE
unsigned fdata_size; unsigned fdata_size = 0;
}; };
/* vim:set ts=4 sw=4 et: */ /* vim:set ts=4 sw=4 et: */

View File

@ -70,7 +70,7 @@ protected:
byte ___[12]; // esp,numfixups,flags byte ___[12]; // esp,numfixups,flags
LE32 relocsize; LE32 relocsize;
}; };
tmt_header_t ih, oh; tmt_header_t ih = {}, oh = {};
}; };
/* vim:set ts=4 sw=4 et: */ /* vim:set ts=4 sw=4 et: */

View File

@ -71,7 +71,7 @@ protected:
BE16 fh_reloc; BE16 fh_reloc;
}; };
tos_header_t ih, oh; tos_header_t ih = {}, oh = {};
// symbols for buildLoader() // symbols for buildLoader()
struct LinkerSymbols { struct LinkerSymbols {

View File

@ -57,7 +57,7 @@ void Packer::assertPacker() const {
assert(getVersion() >= 11); assert(getVersion() >= 11);
assert(getVersion() <= 14); assert(getVersion() <= 14);
assert(strlen(getName()) <= 15); assert(strlen(getName()) <= 15);
// info: 36 is the limit for show_all_packers() in help.cpp, but 32 should be enough // info: 36 is the limit for show_all_packers() in help.cpp, but 32 should be enough for now
assert(strlen(getFullName(nullptr)) <= 32); assert(strlen(getFullName(nullptr)) <= 32);
assert(strlen(getFullName(opt)) <= 32); assert(strlen(getFullName(opt)) <= 32);
assert(getCompressionMethods(M_ALL, 10) != nullptr); assert(getCompressionMethods(M_ALL, 10) != nullptr);
@ -471,30 +471,7 @@ unsigned Packer::getRandomId() const {
if (opt->debug.disable_random_id) if (opt->debug.disable_random_id)
return 0x01020304; return 0x01020304;
unsigned id = 0; unsigned id = 0;
#if 0 && defined(__unix__)
// Don't consume precious bytes from /dev/urandom.
int fd = open("/dev/urandom", O_RDONLY | O_BINARY);
if (fd < 0)
fd = open("/dev/random", O_RDONLY | O_BINARY);
if (fd >= 0) {
if (read(fd, &id, 4) != 4)
id = 0;
close(fd);
}
#endif
while (id == 0) { while (id == 0) {
#if (!(HAVE_GETTIMEOFDAY) || ((ACC_OS_DOS32) && defined(__DJGPP__))) && !defined(__wasi__)
id ^= (unsigned) time(nullptr);
id ^= ((unsigned) clock()) << 12;
#else
struct timeval tv;
gettimeofday(&tv, nullptr);
id ^= (unsigned) tv.tv_sec;
id ^= ((unsigned) tv.tv_usec) << 12; // shift into high-bits
#endif
#if HAVE_GETPID
id ^= (unsigned) getpid();
#endif
id ^= (unsigned) fi->st.st_ino; id ^= (unsigned) fi->st.st_ino;
id ^= (unsigned) fi->st.st_atime; id ^= (unsigned) fi->st.st_atime;
id ^= (unsigned) upx_rand(); id ^= (unsigned) upx_rand();
@ -950,9 +927,9 @@ int Packer::prepareMethods(int *methods, int ph_method, const int *all_methods)
// debug // debug
if (opt->debug.use_random_method && nmethods >= 2) { if (opt->debug.use_random_method && nmethods >= 2) {
int method = methods[upx_rand() % nmethods]; int method = methods[upx_rand() % nmethods];
NO_printf("\nuse_random_method = %#x (%d)\n", method, nmethods);
methods[0] = method; methods[0] = method;
nmethods = 1; nmethods = 1;
NO_printf("\nuse_random_method = %d\n", method);
} }
return nmethods; return nmethods;
} }
@ -1019,10 +996,10 @@ done:
if (opt->debug.use_random_filter && nfilters >= 3 && filters[nfilters - 1] == 0) { if (opt->debug.use_random_filter && nfilters >= 3 && filters[nfilters - 1] == 0) {
int filter_id = filters[upx_rand() % (nfilters - 1)]; int filter_id = filters[upx_rand() % (nfilters - 1)];
if (filter_id > 0) { if (filter_id > 0) {
NO_printf("\nuse_random_filter = %#x (%d)\n", filter_id, nfilters - 1);
filters[0] = filter_id; filters[0] = filter_id;
filters[1] = 0; filters[1] = 0;
nfilters = 2; nfilters = 2;
NO_printf("\nuse_random_filter = %d\n", filter_id);
} }
} }
return nfilters; return nfilters;

View File

@ -579,7 +579,7 @@ protected:
ddirs_t ddirs[16]; ddirs_t ddirs[16];
}; };
pe_header_t ih, oh; pe_header_t ih = {}, oh = {};
}; };
class PeFile64 : public PeFile { class PeFile64 : public PeFile {
@ -640,7 +640,7 @@ protected:
ddirs_t ddirs[16]; ddirs_t ddirs[16];
}; };
pe_header_t ih, oh; pe_header_t ih = {}, oh = {};
}; };
/* vim:set ts=4 sw=4 et: */ /* vim:set ts=4 sw=4 et: */

View File

@ -125,6 +125,7 @@ static_assert(sizeof(void *) == sizeof(long));
#include <type_traits> #include <type_traits>
#include <utility> #include <utility>
// C++ system headers // C++ system headers
#include <algorithm>
#include <memory> // std::unique_ptr #include <memory> // std::unique_ptr
// C++ multithreading (UPX currently does not use multithreading) // C++ multithreading (UPX currently does not use multithreading)
#if __STDC_NO_ATOMICS__ #if __STDC_NO_ATOMICS__

View File

@ -26,7 +26,6 @@
*/ */
#include "system_headers.h" #include "system_headers.h"
#include <algorithm>
#define ACC_WANT_ACC_INCI_H 1 #define ACC_WANT_ACC_INCI_H 1
#include "miniacc.h" #include "miniacc.h"
#define ACC_WANT_ACCLIB_GETOPT 1 #define ACC_WANT_ACCLIB_GETOPT 1
@ -260,8 +259,26 @@ const char *upx_getenv(const char *envvar) noexcept {
return nullptr; return nullptr;
} }
// random value from libc; quality is not important for UPX
int upx_rand(void) noexcept { return ::rand(); } int upx_rand(void) noexcept { return ::rand(); }
void upx_rand_init(void) noexcept {
unsigned seed = 0;
#if (!HAVE_GETTIMEOFDAY || (ACC_OS_DOS32 && defined(__DJGPP__))) && !defined(__wasi__)
seed ^= (unsigned) time(nullptr);
seed ^= ((unsigned) clock()) << 12;
#else
struct timeval tv = {};
(void) gettimeofday(&tv, nullptr);
seed ^= (unsigned) tv.tv_sec;
seed ^= ((unsigned) tv.tv_usec) << 12;
#endif
#if HAVE_GETPID
seed ^= ((unsigned) getpid()) << 4;
#endif
::srand(seed);
}
void *upx_calloc(size_t n, size_t element_size) may_throw { void *upx_calloc(size_t n, size_t element_size) may_throw {
size_t bytes = mem_size(element_size, n); // assert size size_t bytes = mem_size(element_size, n); // assert size
void *p = ::malloc(bytes); void *p = ::malloc(bytes);

View File

@ -149,6 +149,7 @@ noinline const char *upx_getenv(const char *envvar) noexcept;
void upx_memswap(void *a, void *b, size_t bytes) noexcept; void upx_memswap(void *a, void *b, size_t bytes) noexcept;
noinline void upx_rand_init(void) noexcept;
noinline int upx_rand(void) noexcept; noinline int upx_rand(void) 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 *);