Skip to content

Accurately get OverlayAddress for UPX-compressed executables#67

Merged
mnadareski merged 3 commits intoSabreTools:mainfrom
HeroponRikiBestest:upx-overlay-address
Mar 14, 2026
Merged

Accurately get OverlayAddress for UPX-compressed executables#67
mnadareski merged 3 commits intoSabreTools:mainfrom
HeroponRikiBestest:upx-overlay-address

Conversation

@HeroponRikiBestest
Copy link
Copy Markdown
Contributor

For UPX-packed executables, OptionalHeader.SizeOfHeaders is consistently 4096 and wrong, wheras PointerToRawData is consistently 1024 and correct. This PR gets the proper size for UPX-compressed executables, since it's needed for most SFX executables.

… for benefit of extractions that need an accurate overlay address.
@mnadareski
Copy link
Copy Markdown
Contributor

As an update here since it may seem to casual observers that this was just abandoned:

We ended up having a much longer conversation in Discord with both of us having hesitancy with changes in either direction. Some testing was done on how consistent a flat replacement of the logic would be (i.e. always use the section data as truth). Initial tests were optimistic that it is generally more reliable than the size of headers.

More testing and thought needs to be done because this will impact the vast majority of scanned files.

@mnadareski mnadareski merged commit 463c3ba into SabreTools:main Mar 14, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants