Commit Graph

579 Commits

Author SHA1 Message Date
John Reiser e56b748435 WIP fixing "upx -t" of shared library
modified:   p_lx_elf.cpp
2022-12-23 11:23:41 -08:00
John Reiser fefce0d5c4 Cleanup "PT_LOAD gap recovery" during upx -d
https://github.com/upx/upx/issues/635
	modified:   p_lx_elf.cpp
2022-12-21 06:53:37 -08:00
John Reiser 1bed77e4d3 'sizeof' returns size_t, which on i386 is not as wide as off_t
https://github.com/upx/upx/issues/629
https://github.com/upx/upx/issues/635
	modified:   p_lx_elf.cpp
2022-12-20 07:21:02 -08:00
John Reiser f2a68023fa MSVC error C4146: unary minus operator applied to unsigned type, result still unsigned
modified:   p_lx_elf.cpp
2022-12-19 16:14:48 -08:00
John Reiser 8ccffc40e3 A real typo that caused an error in "upx -d" de-compressing
modified:   p_lx_elf.cpp
	modified:   ../.github/travis_testsuite_1-expected_sha256sums.sh
2022-12-19 15:45:27 -08:00
John Reiser dd8c1d0441 clang alignment
modified:   p_lx_elf.cpp
2022-12-19 14:31:26 -08:00
John Reiser f9f28ff176 More work on "upx -d" de-compression
https://github.com/upx/upx/issues/629
https://github.com/upx/upx/issues/635
	modified:   p_elf_enum.h
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
	modified:   p_unix.cpp
2022-12-19 13:49:43 -08:00
Markus F.X.J. Oberhumer c23c7a9379 all: minor updates 2022-12-15 16:20:22 +01:00
Markus F.X.J. Oberhumer 9e75fdda66 src: pacify a -Wcast-align warning 2022-12-12 20:07:27 +01:00
John Reiser 4cdf77e16f Stupid MSVC 14.2, 14.3; obtuse clang 14.0.5 (and MemBuffer vs alignment)
MSVC: cannot say "if (0)" to get "check symtax+semantics, but do not emit code"
clang+MemBuffer: must fight too much to get pointer to wider-than-char
	modified:   src/p_lx_elf.cpp
2022-12-11 14:41:38 -08:00
John Reiser d89813e911 Implement de-compress of --android-shlib
64-bit (arm64, aarch64) only for now.  NYI: 32-bit (armv7).
(Also: implied catch-up with all changes by Markus in the meantime.)
https://github.com/upx/upx/issues/599

	modified:   src/p_lx_elf.cpp
	modified:   src/p_lx_elf.h
2022-12-11 13:46:44 -08:00
John Reiser 779b648c5f invert_pt_dynamic: fix thinko; PackLinuxElf64help1 insist on ELF
https://github.com/upx/upx/issues/631
	modified:   src/p_lx_elf.cpp
2022-11-23 19:49:28 -08:00
Markus F.X.J. Oberhumer 16de3e78a5 src: try to fix canUnpack() confusion - see packer.h 2022-11-10 06:00:53 +01:00
John Reiser 2a136c1c1d End users wish to avoid "double packing".
https://github.com/upx/upx/issues/622
	modified:   src/p_lx_elf.cpp
2022-11-09 15:39:16 -08: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
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 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
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
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 b4cb9f8b2f src: silence some bogus GitHub CodeQL warnings; add MemBuffer "+" overload 2022-09-17 07:53:14 +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 d001a63bce Welcome 2022. 2022-09-04 04:24:39 +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 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 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 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
John Reiser e5aeea9ed2 Check more carefully in invert_pt_dynamic()
https://github.com/upx/upx/issues/566
	modified:   p_lx_elf.cpp
2022-02-28 07:55:49 -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
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 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
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 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
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