Accurately get OverlayAddress for UPX-compressed executables (#67)

* Add alternate path for OverlayAddress for upx-compressed executables, for benefit of extractions that need an accurate overlay address.

* Use SectionNames

* Update SabreTools.Serialization/Wrappers/PortableExecutable.cs

---------

Co-authored-by: Matt Nadareski <mnadareski@outlook.com>
This commit is contained in:
HeroponRikiBestest
2026-03-14 11:18:19 -04:00
committed by GitHub
parent 92356903cc
commit 463c3ba50d

View File

@@ -343,7 +343,10 @@ namespace SabreTools.Serialization.Wrappers
}
// Search through all sections and find the furthest a section goes
long endOfSectionData = OptionalHeader.SizeOfHeaders;
// OptionalHeader.SizeOfHeaders is inconsistent here so first section is used instead
// TODO: Investigate cases where first section pointer does not work
long endOfSectionData = SectionTable[0].PointerToRawData;
Array.ForEach(SectionTable, s => endOfSectionData += s.SizeOfRawData);
// If we didn't find the end of section data