John Reiser
be23f93ee6
upx_uint8_t
...
https://github.com/upx/upx/issues/545
modified: p_mach.h
2021-12-27 08:49:05 -08:00
John Reiser
fcdf0e92c1
Use upx_uint32_t, upx_uint64_t
...
Avoid complaints from x86_64-w64-mingw32-gcc (GCC) 9.3-win32 20200320
https://github.com/upx/upx/issues/545
modified: p_mach.h
2021-12-27 08:33:54 -08:00
John Reiser
2d6987252e
is_bad_linker_command()
...
https://github.com/upx/upx/issues/545
modified: p_mach.cpp
2021-12-27 08:14:19 -08:00
John Reiser
4a9c46253e
Validate input LC_ commands in order to defend against fuzzers
...
TODO: validate in ::unpack(), too
https://github.com/upx/upx/issues/545
modified: p_mach.cpp
modified: p_mach.h
modified: p_mach_enum.h
2021-12-26 19:40:34 -08:00
John Reiser
5bcf9dd8af
Do not complain for minimal DT_GNU_HASH as by Rust.
...
Also: .p_type is 32 bits only!
https://github.com/upx/upx/issues/525
modified: p_lx_elf.cpp
2021-12-25 12:39:31 -08:00
John Reiser
284adb203f
Better checking of DT_HASH.nbuckets
...
https://github.com/upx/upx/issues/507
modified: p_lx_elf.cpp
2021-12-24 15:52:16 -08:00
John Reiser
adafa841f7
Some PT_LOAD must have (p_flags & PF_X)
...
https://github.com/upx/upx/issues/511
modified: p_lx_elf.cpp
2021-12-24 15:32:19 -08:00
John Reiser
fdc5d25d03
Require DT_STRSZ
...
https://github.com/upx/upx/issues/512
modified: p_lx_elf.cpp
2021-12-24 15:08:22 -08:00
Kornel Pal
990d0ec543
PE: Remove duplicate oxrelocs write
2021-12-22 05:07:54 +01:00
Kornel Pal
00e3d992e8
Sync stubs
2021-12-22 03:05:53 +01:00
Kornel Pal
937bfa4e49
PE: Add support for EFI images
2021-12-22 03:05:24 +01:00
Kornel Pal
1d9c211eed
PE: Make imports in decompressor stub optional
2021-12-22 03:00:17 +01:00
Kornel Pal
76ddf6b8da
PE: Add position independent decompressor stub for i386
2021-12-22 02:58:09 +01:00
Kornel Pal
7f1f29b0d8
PE: Remove empty non-compressed section
2021-12-22 02:57:10 +01:00
Kornel Pal
222471744f
PE: Remove file alignment restriction
2021-12-22 02:56:09 +01:00
Kornel Pal
cc100be26e
PE: Fix stripped relocation handling
2021-12-22 02:55:33 +01:00
Kornel Pal
966b571b7c
PE: Use no red zone on AMD64
2021-12-16 06:59:26 +01:00
Kornel Pal
f3e710394a
PE: Set header size on 64-bit too
2021-12-16 06:57:39 +01:00
Kornel Pal
bfd1f1fbfa
PE: Fix relocation parsing and validation
2021-12-16 06:56:01 +01:00
Efreak
a09146b5e0
unreferenced variable breaks build
2021-12-02 14:00:40 -08:00
John Reiser
e2dbc661f1
Sync stub
...
modified: stub/i386-linux.elf-entry.h
2021-12-03 08:38:26 -08:00
John Reiser
7626e09f66
Fix jl ==> jb (unsigned compare)
...
modified: stub/src/i386-linux.elf-entry.S
2021-12-03 08:27:23 -08:00
Kirill A. Korinsky
248a6980cf
Revert -std=c++14
...
This commit reverts 648fa30f22 which was removed by d60c46371d which is fixed https://github.com/upx/upx/issues/440
2021-11-27 13:22:54 +01:00
John Reiser
f956bfc797
Allow slack for non-GLIBC tool chains versus -Wzero-as-null-pointer-constant
...
https://github.com/upx/upx/pull/531
modified: conf.h
2021-11-27 06:58:38 -08:00
bitraid
6da79783ea
PE: Handle empty imports
2021-05-15 21:41:31 +03:00
John Reiser
bd441e83ae
WIP: de-compression of old-style shlib
...
modified: p_lx_elf.cpp
2021-09-06 08:43:20 -07:00
John Reiser
02bd9cc403
IMAGE_SUBSYSTEM_EFI_APPLICATION
...
Beginning of support for compressing EFI files; lacks run-time decompressor.
https://github.com/upx/upx/issues/518
modified: p_armpe.cpp
modified: p_w32pe.cpp
modified: p_w64pep.cpp
modified: pefile.cpp
modified: pefile.h
2021-09-06 08:38:51 -07:00
John Reiser
c9f6a3583c
WIP 64-bit shlib
...
modified: p_lx_elf.cpp
2021-08-07 06:45:01 -07:00
John Reiser
076aaf829a
WIP: Elf64 shlib compress+decompress seems to work
...
modified: p_lx_elf.cpp
modified: p_lx_elf.h
modified: p_unix.cpp
2021-07-05 13:47:19 -07:00
John Reiser
85f0c5a445
WIP: Elf64 shlib cleanup
...
modified: file.cpp
modified: file.h
modified: p_elf_enum.h
modified: p_lx_elf.cpp
modified: p_lx_elf.h
2021-07-02 18:33:38 -07:00
John Reiser
d5263a56ce
WIP: handling shared library
...
modified: p_lx_elf.cpp
modified: p_unix.cpp
modified: p_unix.h
2021-05-22 16:03:53 -07:00
Markus F.X.J. Oberhumer
6aa641e5aa
Update submodules.
2021-05-15 06:03:48 +02:00
John Reiser
504839951a
arm64 clear_cache at end of de-compress
...
https://github.com/upx/upx/issues/441
modified: stub/src/arch/arm64/v8/macros.S
modified: stub/src/arch/arm64/v8/lzma_d.S
modified: stub/src/arch/arm64/v8/nrv2b_d32.S
modified: stub/src/arch/arm64/v8/nrv2d_d32.S
modified: stub/src/arch/arm64/v8/nrv2e_d32.S
modified: stub/arm64-darwin.macho-entry.h
modified: stub/arm64-linux.elf-entry.h
modified: stub/arm64-linux.shlib-init.h
modified: stub/tmp/arm64-darwin.macho-entry.bin.dump
modified: stub/tmp/arm64-linux.elf-entry.bin.dump
modified: stub/tmp/arm64-linux.shlib-init.bin.dump
2021-05-16 09:53:03 -07:00
bitraid
d55746f62d
PE: disable CFG and compress with --force
2021-05-01 18:05:27 +03:00
bitraid
144010295e
Improve --strip-relocs
...
- Remove .reloc section
- Enable for 64-bit images
- Abort if explicitly set on unsupported image
- Use with --force to remove ASLR / apply when imagebase < default
2021-04-25 20:15:07 +03:00
John Reiser
181c752488
WIP: un_shlib_1
...
modified: p_lx_elf.cpp
modified: p_lx_elf.h
2021-05-08 11:14:31 -07:00
John Reiser
bd4aca5c12
generated stub files
...
https://github.com/upx/upx/issues/473
modified: stub/mips.r3000-linux.shlib-init.h
modified: stub/mipsel.r3000-linux.shlib-init.h
modified: stub/tmp/mips.r3000-linux.shlib-init.bin.dump
modified: stub/tmp/mipsel.r3000-linux.shlib-init.bin.dump
2021-05-07 11:15:41 -07:00
John Reiser
ad6d73c875
/proc/self/auxv for AT_PAGESZ because musl calls _init with no args
...
https://github.com/upx/upx/issues/473
modified: mipsel.r3000-linux.shlib-init.S
2021-05-07 09:36:07 -07:00
bitraid
c5cc83d424
Fix unoptimizeReloc() to process all relocs
2021-04-21 23:06:55 +03:00
John Reiser
766fe466d6
PAGE_SIZE varies: Apple M1 uses 16K
...
modified: p_mach.cpp
modified: p_mach.h
modified: p_mach_enum.h
2021-04-11 15:19:24 -07:00
John Reiser
333a288248
shlib: Don't compress below xct_off (except Elf headers)
...
modified: p_lx_elf.cpp
2021-04-11 15:16:34 -07:00
John Reiser
613df414ed
Fix off-by-1 in invert_pt_dynamic; SHT_NOBITS occupies no space
...
modified: p_lx_elf.cpp
2021-04-11 15:09:55 -07:00
John Reiser
be050693f2
PackLinuxElf::canUnpack must checkEhdr() for ELF input
...
https://github.com/upx/upx/issues/485
modified: p_lx_elf.cpp
2021-04-10 10:11:48 -07:00
goushibee
bf957f435e
fix issue 486
2021-04-07 15:40:13 +08:00
bitraid
9ea2b31541
PE: fix SectionHeadersSize of SizeOfHeaders value
2021-04-06 22:49:31 +03:00
John Reiser
cb70a5fef5
Enable usual grep for function definition
...
Developer convenience: no space between function name and left paren
modified: compress.cpp
2021-04-03 12:46:20 -07:00
Markus F.X.J. Oberhumer
d33a34f016
Revert some changes from previous commit to pacify clang
...
-Winconsistent-missing-override warnings.
2021-03-28 21:40:13 +02:00
Markus F.X.J. Oberhumer
f6ff5a2805
Cleanups: start working on -Wsuggest-override, add some "final". NFCI.
2021-03-28 21:19:29 +02:00
bitraid
1518e5bc98
PE: fix SizeOfHeaders value of Optional Header field
2021-03-25 21:41:49 +02:00
John Reiser
78f48d65d5
Allow 0==nbucket for DT_HASH, DT_GNU_HASH
...
static linked 'Rust' program with no symbols
https://github.com/upx/upx/issues/476
2021-03-25 07:22:01 -07:00
John Reiser
b81ec224b7
Fix headway argument to invert_pt_dynamic()
...
https://github.com/upx/upx/issues/473
modified: p_lx_elf.cpp
2021-03-25 07:10:40 -07:00
John Reiser
4be6cfebcd
get_te32() when checking DT_GNU_HASH chains (MIPS .so)
...
https://github.com/upx/upx/issues/473
modified: p_lx_elf.cpp
2021-03-23 18:21:45 -07:00
John Reiser
98973dd8b9
get_te32() when checking DT_HASH chains (MIPS .so)
...
https://github.com/upx/upx/issues/473
modified: p_lx_elf.cpp
2021-03-23 06:45:01 -07:00
John Reiser
1218b6ff2a
Check more in invert_pt_dynamic
...
https://github.com/upx/upx/issues/471
modified: p_lx_elf.cpp
2021-03-16 18:46:11 -07:00
John Reiser
ba5c77c9e5
Reject if MZ and PE headers overlap
...
Overlap ('leanify', etc.) causes headaches.
https://github.com/upx/upx/issues/231
modified: p_w32pe.cpp
modified: p_w64pep.cpp
modified: pefile.cpp
2021-03-14 15:20:15 -07:00
John Reiser
cb60603950
Turn off BUILD_TYPE_DEBUG to enable CI build amd64-win64-gcc-9 to pass.
...
modified: Makefile
2021-03-07 09:33:16 -08:00
John Reiser
0a69e7803b
Fix errors detected by "make run-testsuite".
...
total_out does not matter when option -t writes no output file.
Subtle error in generateElfHdr() [noted by address sanitizer].
New member function is_LOAD32() to avoid confusion with (1+ LO_PROC).
modified: p_lx_elf.cpp
modified: p_lx_elf.h
2021-03-06 15:31:56 -08:00
John Reiser
baa9090198
Change back to lzma-sdk d5bed9963d051c9e5690b12199eab6884a592c43
...
modified: lzma-sdk
2021-03-06 12:05:23 -08:00
John Reiser
e78a08b8fc
change lzma-sdk to latest commit 44db23cc6d6b607986dace07b17fece1af925558 on its master
2021-03-06 10:46:40 -08:00
John Reiser
7e5e6012df
PackMachFat::canPack handles case PackMachFat::CPU_TYPE_ARM64
...
modified: p_mach.cpp
2021-03-06 09:59:51 -08:00
John Reiser
0a1d24d1d9
Remove nit from PackLinuxElf64::generateElfHdr [address sanitizer]
...
modified: p_lx_elf.cpp
2021-03-05 16:33:25 -08:00
John Reiser
35555bfb8a
WIP: PackLinuxElf64::unpack working for shared libraries (non-Android)
...
modified: p_lx_elf.cpp
modified: p_lx_elf.h
modified: p_unix.cpp
2021-03-05 16:20:36 -08:00
John Reiser
c9cb42df40
WIP: hacking un_shlib_1
...
modified: p_lx_elf.cpp
2021-02-28 17:12:20 -08:00
John Reiser
2be03028f4
WIP: un_shlib_1
...
modified: p_lx_elf.cpp
modified: p_lx_elf.h
2021-02-27 19:27:12 -08:00
John Reiser
214dd0a522
4 fewer bytes of code?
...
modified: arm64-linux.elf-fold.h
modified: tmp/arm64-linux.elf-fold.map
2021-02-23 02:24:24 -08:00
John Reiser
182e0796df
Split PackLinuxElf64::unpack for main program vs shared library
...
modified: p_lx_elf.cpp
2021-02-22 16:15:03 -08:00
John Reiser
fb844a8ed1
total_in, total_out move to PackUnix
...
modified: p_lx_elf.cpp
modified: p_lx_elf.h
modified: p_lx_interp.cpp
modified: p_mach.cpp
modified: p_unix.cpp
modified: p_unix.h
2021-02-22 16:13:40 -08:00
John Reiser
6be3e747ca
Remove unrelated debugging
...
modified: stub/src/arm64-linux.elf-fold.S
2021-02-15 11:40:04 -08:00
John Reiser
23f63e4196
WIP unpacking ELF shared library
...
modified: Makefile
modified: lzma-sdk
modified: p_lx_elf.cpp
modified: p_lx_elf.h
modified: p_mach.cpp
modified: p_unix.cpp
modified: p_unix.h
modified: packer.cpp
modified: packer.h
modified: stub/arm64-linux.elf-fold.h
modified: stub/src/arm64-linux.elf-fold.S
modified: stub/tmp/arm64-linux.elf-fold.map
2021-01-15 14:11:09 -08:00
John Reiser
fd6837b267
Another checkAlreadyPacked()
...
https://github.com/upx/upx/issues/463
modified: Makefile
modified: p_mach.cpp
2021-02-26 15:15:28 -08:00
John Reiser
1c29f921e0
getSizeForCompression worst cases
...
https://github.com/upx/upx/issues/463
modified: Makefile
modified: mem.cpp
2021-02-25 20:04:16 -08:00
John Reiser
1ab6e01de2
MacOS BigSur wants no MH_DYLDLINK for our MH_EXECUTE
...
https://github.com/upx/upx/issues/434
modified: p_mach.cpp
2021-02-14 13:23:19 -08:00
John Reiser
2469563b26
Mach_ARM64_thread_state padded to (0 mod 8)
...
https://github.com/upx/upx/issues/446 (partial)
modified: p_mach.cpp
modified: p_mach.h
modified: p_mach_enum.h
2021-01-30 16:11:32 -08:00
John Reiser
00139caf43
More robust PackWcle::decodeFixups()
...
https://github.com/upx/upx/issues/455
modified: p_wcle.cpp
2021-01-23 15:37:52 -08:00
John Reiser
21d102c84f
Better checking of Mach_header.ncmds, .sizeofcmds
...
Improves earlier fix.
https://github.com/upx/upx/issues/447
modified: p_mach.cpp
2021-01-23 13:52:54 -08:00
John Reiser
f17d9967c2
Clarify comment in previous commit
...
modified: main.cpp
2021-01-20 05:54:53 -08:00
Liam Murphy
0569ef37ba
add comment explaining code as per PR review
2021-01-20 02:29:08 +00:00
Liam Murphy
984334c9a1
reset done_output_name counter upx_main()
2021-01-18 00:16:49 +00:00
John Reiser
34a25e61c7
"%zx" for ptrdiff_t in hex printf
...
modified: p_wcle.cpp
2021-01-17 19:36:36 -08:00
John Reiser
ed3f45953e
Try not to run off the end of selfrel_fixups.
...
https://github.com/upx/upx/issues/455
modified: p_wcle.cpp
modified: packer.cpp
2021-01-17 19:21:32 -08:00
John Reiser
80de11bc5b
Detect Mach_header.sizeofcmds==0
...
https://github.com/upx/upx/issues/448
modified: p_mach.cpp
2021-01-17 17:09:35 -08:00
John Reiser
5f98bb0ab0
De-compress allows old-style LC_UNIXTHREAD with one LC_SEGMENT
...
https://github.com/upx/upx/issues/447
modified: p_mach.cpp
2021-01-15 15:03:26 -08:00
Markus F.X.J. Oberhumer
d86d5314ba
Modernize libc usage: more cleanups.
2021-01-05 22:03:29 +01:00
Markus F.X.J. Oberhumer
700c8730cf
Modernize libc usage: stop using off_t, use modern printf.
...
C++ 14 is here, and old versions of MSVC and MSVCRT have
haunted us long enough.
2021-01-05 18:52:05 +01:00
Markus F.X.J. Oberhumer
a8fa3ca5cf
Use correct native types with "alignas(1)".
2021-01-04 21:13:49 +01:00
Markus F.X.J. Oberhumer
9aef7b0d6f
Use C++ 14 alignas(), init some struct fields just because of good practice.
2021-01-04 21:02:07 +01:00
Markus F.X.J. Oberhumer
2575eef3c0
clang-format more files.
...
"Gofmt's style is nobody's favourite, but gofmt is everybody's favourite."
- Rob Pike
2021-01-04 20:26:31 +01:00
Markus F.X.J. Oberhumer
8236276a90
Add and use .clang-format file.
2021-01-04 19:07:17 +01:00
Markus F.X.J. Oberhumer
fdc68812c5
clang-format-10.0.1 files.
2021-01-04 17:27:48 +01:00
Markus F.X.J. Oberhumer
9db6d18d11
Now using upx-stubtools 20210104 with new clang-format-10.0.1.
2021-01-04 17:23:57 +01:00
Markus F.X.J. Oberhumer
f962afe146
Various cosmetic updates and refactors. NFCI.
2021-01-04 17:20:57 +01:00
Markus F.X.J. Oberhumer
adcd569852
Makefile: update default sanitizer flags.
2021-01-04 17:20:06 +01:00
Markus F.X.J. Oberhumer
d045b7f223
Update bele.h to better work with modern compilers.
2021-01-02 16:45:58 +01:00
Markus F.X.J. Oberhumer
baa1ed9be3
Update CI to use lastest zlib. Update Makefile.
2021-01-01 23:24:31 +01:00
Markus F.X.J. Oberhumer
0af8998be6
Bump version date.
2021-01-01 20:45:11 +01:00
Markus F.X.J. Oberhumer
9131d5216f
Welcome 2021.
2021-01-01 20:39:22 +01:00
Markus F.X.J. Oberhumer
fb14a7991d
Fix Makefile breakage in previous commit.
2020-12-15 02:15:34 +01:00
Markus F.X.J. Oberhumer
ff53862dab
Extract upx_main() for compilation with -DWITH_GUI.
2020-12-14 22:10:07 +01:00
Markus F.X.J. Oberhumer
49245a20c5
Update Makefile and compiler checks so that users don't inadvertently
...
change mandatory compiler flags.
2020-12-14 20:53:54 +01:00
John Reiser
13bc031163
Check DT_REL/DT_RELA, DT_RELSZ/DT_RELASZ
...
https://github.com/upx/upx/issues/421
modified: p_lx_elf.cpp
2020-12-11 13:38:18 -08:00