Adjust overlay address for PE using certificate table

This commit is contained in:
Matt Nadareski
2025-09-25 13:53:56 -04:00
parent 963c333c2e
commit 4577311432

View File

@@ -438,6 +438,14 @@ namespace SabreTools.Serialization.Wrappers
return _overlaySize;
}
// If we have certificate data, use that as the end
if (OptionalHeader?.CertificateTable != null)
{
int certificateTableAddress = (int)OptionalHeader.CertificateTable.VirtualAddress;
if (certificateTableAddress != 0 && certificateTableAddress < dataLength)
dataLength = certificateTableAddress;
}
// Get the overlay address if possible
long endOfSectionData = OverlayAddress;