mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-07-18 23:05:11 +00:00
Fix crash in SolidShield scanning (fixes #76)
This commit is contained in:
@@ -343,7 +343,16 @@ namespace BurnOutSharp.ExecutableType.Microsoft
|
||||
int startingIndex = (int)Math.Max(section.PointerToRawData + offset, 0);
|
||||
int readLength = (int)Math.Min(section.VirtualSize - offset, content.Length);
|
||||
|
||||
return content.ReadBytes(ref startingIndex, readLength);
|
||||
try
|
||||
{
|
||||
return content.ReadBytes(ref startingIndex, readLength);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Just absorb errors for now
|
||||
// TODO: Investigate why and when this would be hit
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
|
||||
// Search the last two available sections
|
||||
var sectionNames = pex.GetSectionNames();
|
||||
for (int i = sectionNames.Length - 2; i < sectionNames.Length; i++)
|
||||
for (int i = (sectionNames.Length >= 2 ? sectionNames.Length - 2 : 0); i < sectionNames.Length; i++)
|
||||
{
|
||||
var nthSectionRaw = pex.ReadRawSection(fileContent, sectionNames[i], first: false);
|
||||
if (nthSectionRaw != null)
|
||||
|
||||
Reference in New Issue
Block a user