1
0
mirror of https://github.com/upx/upx synced 2025-10-12 20:59:43 +08:00
Commit Graph

3306 Commits

Author SHA1 Message Date
John Reiser
37f27a1262 "gcc -Werror=format-security" is small-minded
... and does not perform constant propagation
	modified:   src/p_vmlinx.cpp
2022-11-08 13:36:28 -08:00
Markus F.X.J. Oberhumer
2b8a7a492a src/util: fix compilation when not using xspan 2022-11-08 20:38:52 +01:00
Markus F.X.J. Oberhumer
db56bbb11b src/util: forward memset() in xspan_fwd.h 2022-11-08 20:34:44 +01:00
John Reiser
82d26f04a4 p_vmlinx was too eager
https://github.com/upx/upx/issues/622
	modified:   src/p_vmlinx.cpp
2022-11-08 10:30:48 -08:00
Markus F.X.J. Oberhumer
2d74298001 make: update Makefiles 2022-11-08 03:52:43 +01:00
Markus F.X.J. Oberhumer
ce21254ed2 all: misc cleanups 2022-11-06 08:35:00 +01:00
John Reiser
c8a3acbba8 Static executable with 4 PT_LOAD has only ELF headers in first PT_LOAD
https://github.com/upx/upx/issues/615
2022-11-02 10:03:25 -07:00
Markus F.X.J. Oberhumer
81e11987a2 all: add UPX_VERSION_GIT_DESCRIBE 2022-11-02 10:35:40 +01:00
Markus F.X.J. Oberhumer
668cefec2f src: mention UPX_CONFIG_DISABLE_GITREV build config 2022-11-02 02:52:20 +01:00
John Reiser
2b9e83256d SELinux execmod requires no PROT_EXEC when PROT_WRITE
modified:   src/stub/src/amd64-linux.elf-main.c

	modified:   src/stub/amd64-linux.elf-fold.h
	modified:   src/stub/arm64-linux.elf-fold.h
	modified:   src/stub/powerpc64-linux.elf-fold.h
	modified:   src/stub/powerpc64le-linux.elf-fold.h
	modified:   src/stub/tmp/amd64-linux.elf-fold.map
	modified:   src/stub/tmp/arm64-linux.elf-fold.map
	modified:   src/stub/tmp/powerpc64-linux.elf-fold.map
	modified:   src/stub/tmp/powerpc64le-linux.elf-fold.map
2022-10-28 13:04:17 -07:00
Markus F.X.J. Oberhumer
bce109ab54 all: post-release version bump 2022-10-28 17:10:52 +02:00
Markus F.X.J. Oberhumer
69ca635c4c all: prepare for 4.0.0 release 2022-10-28 10:38:03 +02:00
Markus F.X.J. Oberhumer
e0bf460993 src: rename membuffer "Uncompression" to "Decompression" 2022-10-28 10:34:31 +02:00
John Reiser
50a6698715 Each PROT_WRITE segment has implicit .bss on end of last page (64-bit only for now);
Also  workaround kernel bug invoking the escape hatch on arm64 (aarch64).
https://github.com/upx/upx/issues/611
2022-10-27 11:01:37 -07:00
Markus F.X.J. Oberhumer
7dd2cdea1e src: deprecate util/bptr.h 2022-10-27 17:52:15 +02:00
Markus F.X.J. Oberhumer
295889023f all: set next version back to 4.0.0, bump tentative release date, update
docs
2022-10-27 17:36:02 +02:00
Markus F.X.J. Oberhumer
feef2e38cf all: final tweaks for release 2022-10-27 16:53:16 +02:00
Markus F.X.J. Oberhumer
e910a9dc3e all: change version back to 3.99; docs: warn about know regressions and
clarify GPLv2+ COPYING
2022-10-27 16:00:25 +02:00
Markus F.X.J. Oberhumer
e5c0d998b7 src: fully deprecate src/Makefile; minor doc and CI cleanups 2022-10-25 01:48:45 +02:00
Markus F.X.J. Oberhumer
63f6fef964 all: don't use egrep or fgrep 2022-10-25 01:47:42 +02:00
Markus F.X.J. Oberhumer
983eb6d676 src: improve error message when using doctest options like '--dt-help'; add
doctest info to help.cpp
2022-10-25 01:47:38 +02:00
Markus F.X.J. Oberhumer
75a769759d src/stub: sync stubs 2022-10-24 12:56:49 +02:00
John Reiser
2354b01bad Adapt to libbfd: "no Shdrs" requires 0==.e_shentsize and 0==.e_shnum
modified:   p_lx_elf.cpp
2022-10-24 12:56:49 +02:00
John Reiser
c331b9f1e2 Zero the tail of last RW page, even when variable page size
https://github.com/upx/upx/issues/611
	modified:   stub/src/amd64-linux.elf-main.c
2022-10-24 12:56:49 +02:00
John Reiser
afeaeeddec munmap(, Phdr[C_TEXT=1].p_memsz); // not .p_vaddr
modified:   stub/src/arm64-linux.elf-fold.S
	modified:   stub/src/powerpc64le-linux.elf-fold.S
2022-10-24 12:56:49 +02:00
John Reiser
ab7ef9f511 Document the value of "brk #0" instruction
modified:   stub/src/arm64-linux.elf-entry.S
2022-10-24 12:56:49 +02:00
John Reiser
d3ad6d25d8 PackLinuxElf64::asl_pack2_Shdrs() for better fit in logical flow
modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2022-10-24 12:56:49 +02:00
John Reiser
2e29f9fa5f pack2() fixes for --android-shlib
WIP for https://github.com/upx/upx/issues/599
	modified:   p_lx_elf.cpp
2022-10-24 12:56:49 +02:00
John Reiser
5d9f71bb13 asl_pack1_Shdrs()
modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2022-10-24 12:56:49 +02:00
John Reiser
82ed25bb44 Major fix 64-bit un_shlib_1() and unpack(), but not --android-shlib
Also canUnpack() is really a 'bool' which sets overlay_offset
when 'true'; confusing!
        https://github.com/upx/upx/issues/599 (partial)
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
	modified:   p_unix.h
2022-10-24 12:56:49 +02:00
Markus F.X.J. Oberhumer
f57393c0e8 all: simplify include path handling; update src/Makefile 2022-10-24 12:56:35 +02:00
Markus F.X.J. Oberhumer
b54cced19c src: add some tests for compress_zlib 2022-10-24 12:18:25 +02:00
Markus F.X.J. Oberhumer
60a0544314 all: bump tentative release date 2022-10-23 23:15:00 +02:00
Markus F.X.J. Oberhumer
283c1cf931 src: add --version-short option; support doctest --dt-XXX options; cleanups 2022-10-23 23:09:13 +02:00
Markus F.X.J. Oberhumer
fff53efc05 src: add some more xspan tests 2022-10-20 14:06:20 +02:00
Markus F.X.J. Oberhumer
07d368adca all: misc cleanups 2022-10-20 02:09:05 +02:00
Markus F.X.J. Oberhumer
13276d93fa all: bump tentative release date 2022-10-18 21:07:48 +02:00
John Reiser
72613d06a5 Look for PackHeader in the right place.
https://github.com/upx/upx/issues/606
	modified:   p_mach.cpp
2022-10-11 08:08:55 -07:00
John Reiser
48ad5513ff un_shlib_1() allows test mode ("-t") which has (nullptr == fo)
modified:   p_lx_elf.cpp
2022-10-07 12:52:21 -07:00
John Reiser
201d9f1346 Fix length when stub unmaps compressed input for main program
https://github.com/upx/upx/issues/606
	modified:   ../.github/travis_testsuite_1-expected_sha256sums.sh
	modified:   stub/amd64-linux.elf-fold.h
	modified:   stub/src/amd64-linux.elf-fold.S
	modified:   stub/tmp/amd64-linux.elf-fold.map
2022-10-07 09:53:29 +02:00
John Reiser
1e8f1f49d0 is_bad_linker_command() ignores LC_REQ_DYLD
https://github.com/upx/upx/issues/606
	modified:   p_mach.cpp
2022-10-06 10:15:10 -07:00
Markus F.X.J. Oberhumer
65707900bc src: remove more traces of fictional powerpc64le-darwin 2022-10-06 15:53:50 +02:00
Markus F.X.J. Oberhumer
c4437cb293 all: add support for a basic "make test" 2022-10-06 14:10:35 +02:00
Markus F.X.J. Oberhumer
e2b86a49db src: fix recently introduced bug in unoptimzeReloc 2022-10-06 14:09:45 +02:00
John Reiser
05ff7e35a1 Warn for big shell scripts, and send them to --force-execve.
Also propagte error code when execve() fails for compressed shell,
to avoid confusion of `hlt` ==> SIGSEGV.
https://github.com/upx/upx/issues/604
2022-10-05 01:30:32 +02:00
Markus F.X.J. Oberhumer
f67cec4752 submodules: update for new version 2022-10-04 15:33:27 +02:00
Markus F.X.J. Oberhumer
0f42579e68 src: fix djgpp and musl builds 2022-10-02 20:00:30 +02:00
Markus F.X.J. Oberhumer
7398d8f68f src: enable -Wsuggest-override in src/conf.h 2022-09-27 18:17:28 +02:00
John Reiser
ec33109b22 clang-10 requires the use of 'override'
Discovered during gitlab auto-build for https://github.com/upx/upx/issues/595
	modified:   Makefile
	modified:   p_armpe.h
	modified:   p_djgpp2.h
	modified:   p_lx_elf.h
	modified:   p_lx_exc.h
	modified:   p_lx_interp.h
	modified:   p_lx_sh.h
	modified:   p_mach.h
	modified:   p_ps1.h
	modified:   p_tmt.h
	modified:   p_unix.h
	modified:   p_vmlinx.h
	modified:   p_vmlinz.h
	modified:   p_w32pe.h
	modified:   p_w64pep.h
	modified:   pefile.h
2022-09-27 18:15:48 +02:00
John Reiser
a13b4d10d9 After upx-3.96, the de-compressing stub for ELF moved
... so unpack() of newly-compressed ELF by upx-3.96 now says
"CantUnpackException: need a newer version of UPX"
        https://github.com/upx/upx/issues/595
	modified:   p_lx_elf.h
	modified:   packer.h
2022-09-27 18:09:20 +02:00
Markus F.X.J. Oberhumer
36e94e58d0 stub: add mising powerpc64-darwin tmp dump files 2022-09-27 18:09:20 +02:00
John Reiser
d0a52bd483 More cleanup of stubs for powerpc64le-darwin* which does not exist.
Only powerpc64-darwin (BigEndian, no suffix) exists.
https://github.com/upx/upx/issues/596
2022-09-27 15:58:35 +02:00
Markus F.X.J. Oberhumer
4256057c27 src: add a mem_size() call hinted by GitHub CodeQL 2022-09-21 19:28:46 +02:00
John Reiser
55e4a4f086 Assembler local symbol ("1:") clobbered by code in .macro
https://github.com/upx/upx/issues/534
	modified:   stub/arm64-darwin.macho-entry.h
	modified:   stub/arm64-linux.elf-entry.h
	modified:   stub/arm64-linux.shlib-init.h
	modified:   stub/src/arch/arm64/v8/lzma_d.S
	modified:   stub/src/arch/arm64/v8/macros.S
2022-09-20 13:08:14 -07:00
Markus F.X.J. Oberhumer
b4cb9f8b2f src: silence some bogus GitHub CodeQL warnings; add MemBuffer "+" overload 2022-09-17 07:53:14 +02:00
Markus F.X.J. Oberhumer
63298ebd6d src: silence clang-15 compiler warnings 2022-09-16 16:31:34 +02:00
Markus F.X.J. Oberhumer
73c816e468 doc: work on improving docs; add generated files to Git repo 2022-09-16 13:26:13 +02:00
Markus F.X.J. Oberhumer
b8b94ee89e src: more cleanups; NFCI 2022-09-16 13:26:13 +02:00
Markus F.X.J. Oberhumer
81176716d5 src: linker: fix a minor printf format issue detected by codeql 2022-09-16 13:26:13 +02:00
Markus F.X.J. Oberhumer
c75d7a685d src: major cleanups, introduce new eXtended Span class
- initial minimally invasive eXtended Span implementation
- rename ptr_diff to ptr_diff_bytes
- move some files to util subdir
- lots of cleanups
- start using the new checked pointers - this needs some real-world testing
2022-09-16 13:26:13 +02:00
Markus F.X.J. Oberhumer
4318cc22ee src: cleanup option handling, add testcases; fixes #587 2022-09-16 13:26:13 +02:00
Markus F.X.J. Oberhumer
5db34fbf92 src: new ACC version 2022-09-16 13:26:13 +02:00
Markus F.X.J. Oberhumer
4603f1df4b src: bump tentative release date 2022-09-16 13:26:13 +02:00
Markus F.X.J. Oberhumer
c69fcfff9d src: doctest: start work on using doctest 2022-09-16 13:26:13 +02:00
Markus F.X.J. Oberhumer
45e6e73d85 misc: move some scripts from src/stub/scripts to misc/scripts 2022-09-16 13:26:13 +02:00
Markus F.X.J. Oberhumer
be30c26dbb make: update src/Makefile 2022-09-16 13:26:13 +02:00
Markus F.X.J. Oberhumer
79e9b0762c CI: work on new cmake-based CI; updates 2022-09-16 13:26:10 +02:00
Markus F.X.J. Oberhumer
3c47898cf4 make: adjust for new vendor/lzma-sdk location 2022-09-11 13:26:32 +02:00
Markus F.X.J. Oberhumer
a20636fd63 submodules: remove submodule src/lzma-sdk 2022-09-04 04:24:39 +02:00
Markus F.X.J. Oberhumer
aa8cdca0a9 src: consistently use TESTING for internal development tests 2022-09-04 04:24:39 +02:00
Markus F.X.J. Oberhumer
6931a3aa70 src: enable -Wzero-as-null-pointer-constant when using clang 2022-09-04 04:24:39 +02:00
Markus F.X.J. Oberhumer
d001a63bce Welcome 2022. 2022-09-04 04:24:39 +02:00
Markus F.X.J. Oberhumer
0d3377f48b src: p_mach.cpp: disable -Wcast-align warning 2022-08-17 19:54:44 +02:00
John Reiser
aeb04d97c8 powerpc64-darwin.macho (not powerpc64le-darwin.macho)
All Apple PowerPC are BigEndian only.
        https://github.com/upx/upx/issues/596
	modified:   p_mach.cpp
	modified:   p_mach.h
	modified:   packmast.cpp
2022-09-03 12:39:50 -07:00
John Reiser
eb68ab91cd PackDjgpp2::canPack() allows "loose" (non-contiguous) text,data,bss
Hack: grow text to eliminate gap; don't complain unless bss overlaps data
https://github.com/upx/upx/issues/45
	modified:   p_djgpp2.cpp
2022-08-29 11:37:46 +02:00
cui fliter
44a53736ff fix some typos
Signed-off-by: cui fliter <imcusg@gmail.com>
2022-08-23 19:20:21 +02:00
Markus F.X.J. Oberhumer
5f9c50cd3e clang-format 2022-08-10 23:29:43 +02:00
Markus F.X.J. Oberhumer
793d8c1d2e Fix compilation with C++20. 2022-07-17 21:16:11 +02:00
John Reiser
dadbbbdc64 Avoid trouble: disallow empty name of export directory
https://github.com/upx/upx/issues/425
	modified:   pefile.cpp
2022-08-13 12:25:30 -07:00
John Reiser
bfd2153f2b Delete trailing space characters
https://github.com/upx/upx/pull/589
	modified:   pefile.cpp
2022-07-26 20:09:16 -07:00
S01den
077793fa5e Update pefile.cpp
I found a bug by participating to the Binary Golf Grand Prix 3 (https://tmpout.sh/bggp/3/) : upx text.exe segfaults when NumberOfSections in the IMAGE_FILE_HEADER is NULL, so 
if (memcmp(isection[0].name,"UPX",3) == 0) triggers a NULL pointer dereference causing a crash.
To fix it, just have to check if isection is NULL (which means NumberOfSections = 0) or not.
2022-07-27 01:54:01 +02:00
John Reiser
acad3c3000 DT_INIT_ARRAY noes not pertain to DT_* for symbol table info
https://github.com/upx/upx/issues/586
	modified:   p_lx_elf.cpp
2022-07-02 20:52:18 -07:00
John Reiser
3b4627e17e Add filename to infoWarning("file coruupted")
modified:   p_mach.cpp
2022-06-01 08:34:23 -07:00
John Reiser
05976ee1a7 Try harder to de-compress corrupted Mach-o file.
https://github.com/upx/upx/issues/579
	modified:   p_mach.cpp
2022-05-31 11:52:10 -07:00
John Reiser
c1311c78a3 Extra space to force "git commit" to force rebuild for tagging Issue
https://github.com/upx/upx/issues/577
	modified:   p_lx_elf.cpp
2022-05-30 15:19:18 -07:00
John Reiser
717150b7f3 Stupid MSVC: bad C4706: assignment within conditional expression
-    for (unsigned j=0; (k = dt_names[j]); ++j) {
+    for (unsigned j=0; ((k = dt_names[j]), k); ++j) {

The complaint was:
    p_lx_elf.cpp(5710) : warning C4706: assignment within conditional expression
which is INCORRECT, as shown in the change which is 100% equivalent.
The assignment occurs BEFORE the conditional expression.
	modified:   p_lx_elf.cpp
2022-05-30 15:09:34 -07:00
John Reiser
a68c62d938 More placate compilers
https://github.com/upx/upx/issues/577
	modified:   p_lx_elf.cpp
2022-05-30 15:02:53 -07:00
John Reiser
c11f8a569a Placate 'clang' -Wcast-align
https://github.com/upx/upx/issues/577
	modified:   p_lx_elf.cpp
2022-05-30 14:55:39 -07:00
John Reiser
03436d2415 Bug in handling DT_GNU_HASH table.
Fix includes a more-general and stronger heuristic to find the end of
GNU_HASH table when there is no ElfXX_Shdr for it.  64-bit only for now.
(This is needed to help prevent SIGSEGV when processing tampered .exe.)

https://github.com/upx/upx/issues/577
	modified:   p_elf_enum.h
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2022-05-30 14:24:21 -07:00
John Reiser
4ae75375e0 LC_BUILD_VERSION etc for XCode 13+
https://github.com/upx/upx/issues/578
	modified:   p_mach.cpp
	modified:   p_mach_enum.h
2022-05-30 01:05:09 -07:00
John Reiser
2721ef0636 ElfLinker::init() allows symbols and relocations (but not Sections) to be empty
modified:   linker.cpp
	modified:   linker.h
2022-05-04 13:29:36 -07:00
John Reiser
7a232cb330 Allow qemu on host with smaller PAGE_SIZE. Sync stubs.
https://github.com/upx/upx/issues/571
	modified:   ../.github/travis_testsuite_1-expected_sha256sums.sh
	modified:   stub/arm64-linux.elf-fold.h
	modified:   stub/powerpc64-linux.elf-fold.h
	modified:   stub/powerpc64le-linux.elf-fold.h
	modified:   stub/src/amd64-linux.elf-main.c
	modified:   stub/tmp/arm64-linux.elf-fold.map
	modified:   stub/tmp/powerpc64-linux.elf-fold.map
	modified:   stub/tmp/powerpc64le-linux.elf-fold.map
2022-03-25 09:13:10 -07:00
John Reiser
52f19ae330 Cleanup powerpc64le-linux.elf-*.S (forgotten when powerpc-linux.elf*.S)
https://github.com/upx/upx/issues/571
	modified:   stub/powerpc64-linux.elf-entry.h
	modified:   stub/powerpc64-linux.elf-fold.h
	modified:   stub/powerpc64le-linux.elf-entry.h
	modified:   stub/powerpc64le-linux.elf-fold.h
	modified:   stub/src/amd64-linux.elf-main.c
	modified:   stub/src/powerpc64le-linux.elf-entry.S
	modified:   stub/tmp/powerpc64-linux.elf-entry.bin.dump
	modified:   stub/tmp/powerpc64-linux.elf-fold.map
	modified:   stub/tmp/powerpc64le-linux.elf-entry.bin.dump
	modified:   stub/tmp/powerpc64le-linux.elf-fold.map
2022-03-24 19:14:56 -07:00
John Reiser
275477f914 ElfLinker::addSection omits "ABS*" and "UND*" sections
modified:   linker.cpp
2022-03-24 19:09:09 -07:00
John Reiser
78c555b4a6 Handle old-style compressed main programs when de-compressing
modified:   p_lx_elf.cpp
2022-03-22 19:20:09 -07:00
John Reiser
a127125707 Comment the breakpoint instructions for faster analysis by 'grep'
modified:   stub/src/arm.v4a-linux.elf-fold.S
	modified:   stub/src/arm.v5a-darwin.macho-entry.S
	modified:   stub/src/arm.v5a-darwin.macho-fold.S
	modified:   stub/src/arm64-linux.elf-entry.S
	modified:   stub/src/arm64-linux.elf-fold.S
	modified:   stub/src/mipsel.r3000-linux.elf-entry.S
	modified:   stub/src/powerpc64le-linux.elf-entry.S
	modified:   stub/src/powerpc64le-linux.elf-fold.S
2022-03-22 19:18:19 -07:00
John Reiser
f853f91c5b Placate clang re: missing 'override'
modified:   file.h
2022-03-22 19:16:15 -07:00
John Reiser
e7ca5c54ff Fix --brute for p_lx_elf.cpp, which compresses multiple pieces
Force all pieces to use the same de-compressor.
(Future: allow each PT_LOAD to choose its own.)
Has minor wobbles due to page alignment, and size of de-compressor.
64-bit only for now.
https://github.com/upx/upx/issues/570
https://github.com/upx/upx/issues/297
	modified:   p_lx_elf.cpp
	modified:   p_unix.cpp
	modified:   packer.cpp
	modified:   packer.h
2022-03-22 11:46:25 -07:00
John Reiser
663d6b466b WIP: clarify compressWithFilters; reduce size of obuf for PackLinuxElf64
modified:   p_lx_elf.cpp
	modified:   packer.cpp
	modified:   packer.h
2022-03-21 13:49:46 -07:00
John Reiser
34df0d6ef1 More empty HASH and/or GNU_HASH when Rust-musl
https://github.com/upx/upx/issues/568
	modified:   p_lx_elf.cpp
2022-03-12 14:21:51 -08:00