Commit Graph

158 Commits

Author SHA1 Message Date
Markus F.X.J. Oberhumer
75e87a58da src: rework mem_clear() 2023-06-09 18:20:06 +02:00
Markus F.X.J. Oberhumer
320e5b850f all: yet more cleanups
Changes include:
  - use standard names for PE constants
  - add some more "noexcept"
  - improve upx_is_integral type-trait
  - introduce is_same_all and is_same_any type-traits
  - prepare TE-size checks in packer.h
  - CI updates
2023-04-18 17:02:13 +02:00
Markus F.X.J. Oberhumer
15484aa296 all: more cleanups
Changes include:
  - extract headers.h from conf.h
  - use "byte" in some more places
  - unify "const" coding style
  - pefile.cpp: make sort order deterministic
  - simplify some other pefile.cpp code
  - CI updates
2023-03-18 21:27:34 +01:00
Markus F.X.J. Oberhumer
a627648249 all: assorted cleanups and updates
Changes include:
  - add a bunch of "noexcept", mostly to operators and forceinline
  - use "uchar"
  - use "charptr"
  - rename options_t to Options
  - add ptr_check_no_overlap()
  - rewrite p_exe.cpp, NFCI
  - clang-format help.cpp
  - spelling fixes
2023-03-15 00:19:55 +01:00
Markus F.X.J. Oberhumer
3d691645a4 src: pefile: add checkMachine() 2023-02-21 20:33:40 +01:00
Markus F.X.J. Oberhumer
e1edc5f50a src: use 'byte' instead of 'upx_byte'; NFCI 2023-02-21 19:27:23 +01:00
Markus F.X.J. Oberhumer
4a8efd2e2f src: rework optimizeReloc handling; cleanups 2023-02-21 15:19:24 +01:00
Markus F.X.J. Oberhumer
c5059231dc all: rename win32/arm back to wince/arm 2023-02-12 18:58:11 +01:00
Markus F.X.J. Oberhumer
f584c91386 all: canonicalize win32 and win64 file names 2023-02-10 09:49:29 +01:00
Markus F.X.J. Oberhumer
b8d9c2b755 all: assorted updates and cleanups 2023-02-05 17:20:32 +01:00
Markus F.X.J. Oberhumer
0653bb5a72 src: some xspan cleanups 2023-01-30 11:03:11 +01:00
Markus F.X.J. Oberhumer
a444a8a704 src: pefile: fix overly tricky canUnpack0 logic 2023-01-29 12:40:00 +01:00
Markus F.X.J. Oberhumer
3fa18c1799 src: clang-format pefile 2023-01-29 12:34:05 +01:00
Markus F.X.J. Oberhumer
19147963b9 src: pefile: try to work-around a scan-build warning 2023-01-29 12:21:15 +01:00
Markus F.X.J. Oberhumer
58343fc78d src: more outstanding util/xspan renaming; NFC 2023-01-18 10:11:29 +01:00
John Reiser
425b1b44bc Initialize output_capacity for loader
modified:   pefile.cpp
2023-01-09 09:20:43 -08:00
Markus F.X.J. Oberhumer
dd1d5a92d2 all: welcome 2023 2023-01-01 19:49:30 +01:00
Markus F.X.J. Oberhumer
9da4f7a6dc src: clang-format more files; cleanups; NFCI 2022-11-27 12:34:15 +01:00
Markus F.X.J. Oberhumer
d7508d8c09 src: pefile.cpp: replace "membuffer + x - y" with "membuffer + (x - y)"
This is needed because "membuffer + x" is now bounds-checked, and
the temporary addition would trigger an exception.
2022-11-10 00:40:41 +01:00
Markus F.X.J. Oberhumer
28f0bb4e11 src: fix pefile.cpp otls allocation not accounting for alignment. Closes #621. 2022-11-09 19:29:16 +01:00
Markus F.X.J. Oberhumer
ce21254ed2 all: misc cleanups 2022-11-06 08:35:00 +01:00
Markus F.X.J. Oberhumer
e0bf460993 src: rename membuffer "Uncompression" to "Decompression" 2022-10-28 10:34:31 +02: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
c4437cb293 all: add support for a basic "make test" 2022-10-06 14:10:35 +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
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
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
a646231630 aligned_sotls, per Laszlo
https://github.com/upx/upx/issues/556
	modified:   pefile.cpp
2022-02-07 08:39:13 -08:00
John Reiser
1050de5171 Native alignment for the "load config" table
https://github.com/upx/upx/issues/556
	modified:   pefile.cpp
2022-01-15 06:45:47 -08:00
Kornel Pal
620955a724 PE: Fix has_oxrelocs (TLS always has oxrelocs) 2021-12-31 20:45:28 +01:00
John Reiser
2e64a277f8 Fix headway during optimizeReloc()
Later: "Assertion `(soxrelocs == 0) == !has_oxrelocs' failed."
https://github.com/upx/upx/issues/552
	modified:   packer.cpp
	modified:   packer.h
	modified:   pefile.cpp
2021-12-31 10:27:58 -08:00
John Reiser
ea567a8b14 Check when optimizeRelocs()
https://github.com/upx/upx/issues/513
	modified:   packer.h
	modified:   packer.cpp
	modified:   pefile.cpp
	modified:   p_wcle.cpp
	modified:   p_tmt.cpp
2021-12-29 16:57:52 -08:00
Kornel Pal
990d0ec543 PE: Remove duplicate oxrelocs write 2021-12-22 05:07:54 +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
bfd1f1fbfa PE: Fix relocation parsing and validation 2021-12-16 06:56:01 +01:00
bitraid
6da79783ea PE: Handle empty imports 2021-05-15 21:41:31 +03: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
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
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