Handle overlay data better

This commit is contained in:
Matt Nadareski
2022-12-03 21:59:21 -08:00
parent 8e73d7970f
commit f420434fd3

View File

@@ -346,7 +346,7 @@ namespace BurnOutSharp.Wrappers
{
var certificateTable = _executable.OptionalHeader.CertificateTable;
int certificateTableAddress = (int)certificateTable.VirtualAddress.ConvertVirtualAddress(_executable.SectionTable);
if (certificateTableAddress != 0)
if (certificateTableAddress != 0 && certificateTableAddress < endOfFile)
endOfFile = certificateTableAddress;
}
@@ -380,7 +380,7 @@ namespace BurnOutSharp.Wrappers
return null;
// If we're at the end of the file, cache an empty byte array
if (endOfSectionData == endOfFile)
if (endOfSectionData >= endOfFile)
{
_overlayData = new byte[0];
return _overlayData;