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
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
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
9131d5216f
Welcome 2021.
2021-01-01 20:39:22 +01:00
Markus F.X.J. Oberhumer
f7e2266c3f
Start using some C++ 14 features.
2020-12-08 05:40:17 +01:00
John Reiser
bb1df15958
Use 'mb_' prefix on instances of MemBuffer
...
modified: pefile.cpp
modified: pefile.h
2020-12-05 13:53:14 -08:00
Liam Murphy
249431f45f
tweak formatting to reduce diff
2020-11-26 03:00:21 +00:00
Liam Murphy
cbe129795e
migrate to MemBuffer class from New() to remove leak
2020-11-26 00:14:00 +00:00
John Reiser
2a135e245b
Prefer MemBuffer instead of New()+delete
...
https://github.com/upx/upx/issues/428
modified: pefile.cpp
modified: pefile.h
2020-12-05 13:44:19 -08:00
Markus F.X.J. Oberhumer
f218812858
Fix spelling of some constants.
2020-12-03 01:46:30 +01:00
Markus F.X.J. Oberhumer
8a7b980fc0
Avoid a MSVC warning.
2020-12-03 01:44:09 +01:00
John Reiser
10df93536e
Yet another attempt to suppress MSVC C4245
...
https://github.com/upx/upx/issues/435
modified: pefile.cpp
2020-11-29 00:01:22 -08:00
John Reiser
6cad27896f
Another attempt to suppress MSVC C4245
...
https://github.com/upx/upx/issues/435
modified: pefile.cpp
2020-11-28 23:53:49 -08:00
John Reiser
052392d97b
Attempt workaround for MSVC C4245 signed/unsigned mismatch in template 'argument'
...
https://github.com/upx/upx/issues/435
modified: pefile.cpp
2020-11-28 20:23:01 -08:00
Matthijs Lavrijsen
4f3054f07d
PE: only add a TLS relocation if tls_handler_offset_reloc != 0
2020-09-08 11:44:56 +02:00
bitraid
0d7bd52e21
Only pack w/ -f PE files that force integrity check
2020-10-31 19:53:33 +02:00
John Reiser
7c105d7af5
omemmove exactly as much
...
Fix 14992260c60b8d6677a677a9cdfae98b11353df7; revealed by testsuite
modified: pefile.cpp
2020-11-05 15:05:52 -08:00
John Reiser
143049922b
Beware overlap when rebuildImports
...
Based on a hint from a little bird.
modified: pefile.cpp
2020-09-20 14:10:24 -07:00
Mattiwatti
89d0fda9fa
Make PE load config directory address dword aligned
2020-01-21 16:03:40 +01:00
bitraid
6a85bab5da
Don't pack Cotrol Flow Guard PE files
2020-07-28 17:36:13 +03:00
bitraid
17bd0b3248
Don't use --strip-reloc with -d
...
Always restore the relocation section of Portable Executables on
unpacking, if it exists in the compressed image.
2020-04-13 21:38:22 +03:00
bitraid
1ce6f0e6f4
Fix unpacking of ASLR enabled PE files
2020-04-12 03:19:57 +03:00
Markus F.X.J. Oberhumer
d1174385ef
Welcome 2020.
2020-01-08 04:13:28 +01:00
Markus F.X.J. Oberhumer
c2aa5c35f7
Silence a gcc-4.6 compiler warning.
2019-02-25 13:41:54 +01:00
Markus F.X.J. Oberhumer
3667fa4e44
Welcome 2019.
2019-02-15 11:04:09 +01:00
John Reiser
70ed2d0d03
Allow Load Configuration directory > 256, with info().
...
https://github.com/upx/upx/issues/245
modified: pefile.cpp
2019-01-26 07:51:16 -08:00
John Reiser
b711d2f750
TLS callbacks: one entry only
...
https://github.com/upx/upx/issues/186 [partial, incomplete]
(Laszlo hints there is more, but meanwhile this does fix some.)
modified: pefile.cpp
2018-04-06 13:44:24 -07:00
Mattiwatti
2c2e108301
PE: fix comparison against a constant value
...
... due to size always being assigned to right before this comparison,
and instead check against the RVA and size of the export directory
from the header. (note: this is still stricter than the Windows loader
which ignores all of these except the directory RVA, but if the name RVA
is invalid the PE was probably tampered with).
Change 'offset' to 'RVA' in exception message; this field is always an RVA
Author: Mattiwatti <mattiwatti@gmail.com>
modified: pefile.cpp
2018-04-02 09:07:29 -07:00
John Reiser
563165e6ae
Defensive patches from hints by Sean Williams <rootkit@google.com>
...
modified: pefile.cpp
2018-03-29 16:55:21 -07:00
John Reiser
e4b23f7a47
Merge branch 'devel' of https://github.com/upx/upx into devel
2018-01-21 10:30:42 -08:00
John Reiser
f056ecdcd5
pefile: Allow overlap of MZ header and PE header (h.nexepos==0x10)
...
https://github.com/upx/upx/issues/169
This means .codebase is aliased to .nexepos, with both equal to 0x10.
modified: pefile.cpp
2018-01-21 10:29:17 -08:00
Markus F.X.J. Oberhumer
9248f02557
Silence some gcc-8-snapshot compiler warnings.
2018-01-19 14:13:58 +01:00
Markus F.X.J. Oberhumer
021c8db58a
Welcome 2018.
2018-01-19 10:55:32 +01:00
John Reiser
ab35b685d4
Fix pefile.cpp bad range checking for reloc type 3 and 10
...
modified: pefile.cpp
2018-01-18 11:11:19 -08:00
John Reiser
969efe687d
MSVC pecadillos
...
modified: p_lx_elf.cpp
modified: pefile.cpp
2018-01-11 12:01:00 -08:00
John Reiser
143f0accef
PeFile check MZ offset to PE header
...
modified: pefile.cpp
2017-11-21 13:07:42 -08:00
John Reiser
7a0514d9b4
PeFile more checks for Section table
...
modified: pefile.cpp
2017-11-12 21:47:47 -08:00
John Reiser
7e7565299e
PeFile check Section table
...
https://github.com/upx/upx/issues/132
modified: pefile.cpp
2017-11-12 21:02:52 -08:00
László Molnár
ed34a089c6
minor update for a memory derefencing check
2017-11-12 16:19:40 +01:00
John Reiser
d14a2c5282
PeFile fix the recently-added interval checking.
...
https://github.com/upx/upx/issues/143
modified: pefile.cpp
2017-11-09 21:58:25 -08:00
John Reiser
58771ecca6
PeFile: better checking for import descriptors
...
modified: pefile.cpp
2017-11-08 12:38:54 -08:00
John Reiser
5d9dcb634b
PeFile: Defend against bad crafted import descriptors
...
https://github.com/upx/upx/issues/143
modified: pefile.cpp
modified: pefile.h
2017-11-08 11:07:46 -08:00
Markus F.X.J. Oberhumer
c4da5e81fa
Welcome 2017.
2017-01-03 12:02:07 +01:00
Markus F.X.J. Oberhumer
bc80d81432
Silence a bogus scan-build warning.
2016-12-30 23:59:31 +01:00
László Molnár
c7cb036536
fixed data corruption in import handling (issue #32,#34)
2016-12-30 21:31:50 +01:00
Markus F.X.J. Oberhumer
0b4ac35bc9
Tune some MSVC warnings.
2016-12-19 22:57:43 +01:00
László Molnár
c51864ca39
fixed TLS callback handling for PE64
2016-12-18 23:34:27 +01:00
John Reiser
134b829d59
prevent warning C4319: '~': zero extending 'const unsigned int' to 'upx_uint64_t' of greater size
...
modified: linker.cpp
modified: p_lx_elf.cpp
modified: pefile.cpp
2016-11-19 16:46:01 -08:00
Markus F.X.J. Oberhumer
b0207ce524
Some refactoring. NFC.
2016-10-09 13:23:19 +02:00
László Molnár
297d44c614
PE: fixed file data alignment problem
2016-10-09 11:29:29 +02:00
Markus F.X.J. Oberhumer
4b991203df
pefile.cpp: make import sorting independent from qsort() internals.
2016-10-09 00:48:40 +02:00
Markus F.X.J. Oberhumer
38a265741c
Ongoing cleanups.
2016-10-08 18:49:14 +02:00
Markus F.X.J. Oberhumer
06eb244800
Add check_whitespace_git.sh. Minor cleanups.
2016-10-03 04:47:02 +02:00
Markus F.X.J. Oberhumer
f7554374ab
Update email address.
2016-09-28 12:25:01 +02:00
Markus F.X.J. Oberhumer
a0582c5380
pefile.cpp: don't use VLA.
2016-09-27 20:19:43 +02:00
László Molnár
43231826b9
fixed address sanitizer problem (untested)
2016-09-26 08:56:23 +02:00
László Molnár
1c735cc204
fixed too strict checks in resource handling
2016-09-22 22:17:08 +02:00
Markus F.X.J. Oberhumer
83828aa8a3
Update vim modelines.
2016-09-22 17:29:43 +02:00
Markus F.X.J. Oberhumer
96d9968db5
Welcome 2016.
2016-09-22 14:07:14 +02:00
Markus F.X.J. Oberhumer
3bb654cc85
Ongoing cleanups and cruft removal.
2016-09-21 16:42:25 +02:00
Markus F.X.J. Oberhumer
44248f19b5
Introduce mem_size() and New() and start using it.
2016-09-20 15:24:07 +02:00
Markus F.X.J. Oberhumer
e4723e0bad
Avoid some compiler warnings.
2016-09-20 10:54:27 +02:00
Markus F.X.J. Oberhumer
9579a51a8b
pefile.cpp: always use BoundedPtr.
2016-09-20 10:20:42 +02:00
László Molnár
33065ecf04
fixed resource bounds checking when compressing; let --force override throwing an exception
2015-08-11 13:05:10 +02:00
John Reiser
7d4dfbef2b
cleanup IPTR_I_D
2015-05-15 20:56:34 -07:00
John Reiser
404da18aed
IPTR_I_D: 'import' buffer is a subset of ibuf
2015-05-15 20:42:18 -07:00
László Molnár
6ba68a6455
PE related fixes for CERT-FI 829767
2015-05-14 21:46:52 +02:00
Markus F.X.J. Oberhumer
c6724968f1
pefile.cpp: work around a gcc-3.4 limitation.
2015-01-03 00:40:28 +01:00
Markus F.X.J. Oberhumer
fb611a98f9
Welcome 2015.
2015-01-03 00:24:07 +01:00
László Molnár
b3f63ce7ae
pe: fix a bug in pack0() for arm
2014-03-09 23:55:28 +01:00
László Molnár
940341bc9d
arm/pe: import handling updates (untested)
2014-03-08 18:59:26 +01:00
László Molnár
804a0ce601
merge
2014-03-06 22:38:15 +01:00
László Molnár
41054a4c56
handle duplicates in ImportLinker
2014-03-06 22:26:41 +01:00
László Molnár
ca2369f1c1
pe: win32/win64 pack/unpack seems to work again
2014-03-05 23:40:24 +01:00
László Molnár
129cb0b3cd
pe: packing of pe64 starts to work again
2014-03-04 23:51:59 +01:00
László Molnár
632b2ae1ba
pe: pack() logic moved to PeFile
2014-03-02 22:34:52 +01:00
László Molnár
18e55061e1
pepfile.* disabled; PeFile64 class introduced
2014-02-20 00:10:18 +01:00
László Molnár
e49b65723f
pe: canUnpack moved to PeFile
2014-02-19 23:27:41 +01:00
László Molnár
8e52894763
pe: loadconf handling moved to PeFile
2014-02-19 21:45:24 +01:00
László Molnár
07cba6c774
pe32: tls refactoring
2014-02-18 00:23:42 +01:00
László Molnár
9cb639b505
pe32: refactoring of import handling and unpacking continues
2014-02-16 23:04:39 +01:00
Markus F.X.J. Oberhumer
a26c982e93
Welcome 2014.
2014-01-07 23:05:10 +01:00
László Molnár
96708d7592
ImportLinker copied into PeFile
2013-10-12 16:48:56 +02:00
László Molnár
8ab229cca9
pe: refactoring started
2013-10-06 22:57:20 +02:00
Markus F.X.J. Oberhumer
0d3a2072b2
Add some more sanity checks in pefile.cpp.
2013-04-04 14:30:52 +02:00
Markus F.X.J. Oberhumer
87a368a857
Welcome 2013.
2013-02-12 10:14:03 +01:00
Markus F.X.J. Oberhumer
43ce34d547
Welcome 2012.
2012-01-01 22:35:11 +01:00
John Reiser
9c5d0ff2ff
PeFile::processRelocs() defends itself against corrupt PE header
2011-06-08 10:06:42 -07:00
Markus F.X.J. Oberhumer
9bf2b79d9e
Enter 2011.
2011-01-03 08:49:23 +01:00
László Molnár
1e3555a6b7
added some input validity checks (for sf.net bug 3122661)
2010-12-20 00:35:57 +01:00
Stefan Widmann
1d8cb47830
TLS handling updated to v2, ASLR fix in unpacking
2010-08-13 17:44:21 +02:00
Markus F.X.J. Oberhumer
0177a8d277
Use upx_snprintf instead of snprintf.
2010-03-31 02:23:06 +02:00
Markus F.X.J. Oberhumer
6bc3197721
Enter 2010.
2010-02-06 17:15:49 +01:00
John Reiser
aa74276b25
gcc-4.4.1 is more strict about 'const'
2009-08-30 19:44:45 -07:00
Markus F.X.J. Oberhumer
5ed689ceb0
Enter 2009.
2008-12-31 17:07:18 +01:00
Markus F.X.J. Oberhumer
25f1765f36
Support building with OpenWatcom 1.8. Silence some compiler warnings.
2008-12-31 16:56:38 +01:00
Markus F.X.J. Oberhumer
063bd58802
Silence gcc's -Wstrict-aliasing=1 warnings.
2008-12-29 23:15:56 +01:00
Markus F.X.J. Oberhumer
6ff1bd5917
Update my email address.
2008-01-02 10:12:42 +01:00
Markus F.X.J. Oberhumer
fa49dbe2cb
Enter 2008.
2008-01-02 09:42:31 +01:00
László Molnár
fe53b135eb
pe: better icon compression handling
2007-02-24 23:25:11 +01:00
Markus F.X.J. Oberhumer
5e83596a1b
Enter 2007.
2007-01-14 13:08:58 +01:00
László Molnár
c6205ffbe0
tls index should be zero after decompression
2007-01-02 18:16:16 +01:00
Markus F.X.J. Oberhumer
d221187f24
Misc cosmetical cleanups.
2006-12-22 12:36:55 +01:00
László Molnár
d6b33ffd6b
pe: --compress-icons=3 option added to compress all icons
2006-11-22 15:28:35 +01:00
László Molnár
4be3d79e12
arm/pe: fix "missing" icon & version info resource problem for wince 5
2006-11-21 18:25:23 +01:00
Markus F.X.J. Oberhumer
05d03f97fc
Introduce Packer::bele.
2006-11-20 12:01:59 +01:00
László Molnár
9f5c0af5b8
step 0 of refactoring arm/pe & win32/pe ready
2006-07-26 14:00:36 +02:00
László Molnár
6d6eeba5d5
refactoring of arm/pe and win32/pe started
2006-07-25 18:30:12 +02:00