diff --git a/BinaryObjectScanner/Packer/InnoSetup.cs b/BinaryObjectScanner/Packer/InnoSetup.cs index bf1fecba..fbf24ab3 100644 --- a/BinaryObjectScanner/Packer/InnoSetup.cs +++ b/BinaryObjectScanner/Packer/InnoSetup.cs @@ -59,19 +59,27 @@ namespace BinaryObjectScanner.Packer // TODO: Don't read entire file // TODO: Only 64 bytes at the end of the file is needed - var data = nex.ReadArbitraryRange(); - if (data != null) + + byte[]? data; + try { - var matchers = new List + data = nex.ReadArbitraryRange(); + if (data == null) + return "Unknown 1.X"; + } + catch + { + // Ignore errors reading ranges + return "Unknown 1.X"; + } + + var matchers = new List { // "rDlPtS02" + (char)0x87 + "eVx" new(new byte?[] { 0x72, 0x44, 0x6C, 0x50, 0x74, 0x53, 0x30, 0x32, 0x87, 0x65, 0x56, 0x78 }, "1.2.16 or earlier"), }; - return MatchUtil.GetFirstMatch(file, data, matchers, false) ?? "Unknown 1.X"; - } - - return "Unknown 1.X"; + return MatchUtil.GetFirstMatch(file, data, matchers, false) ?? "Unknown 1.X"; } } } diff --git a/BinaryObjectScanner/Protection/CDDVDCops.cs b/BinaryObjectScanner/Protection/CDDVDCops.cs index cae8ffcd..c708f468 100644 --- a/BinaryObjectScanner/Protection/CDDVDCops.cs +++ b/BinaryObjectScanner/Protection/CDDVDCops.cs @@ -73,9 +73,18 @@ namespace BinaryObjectScanner.Protection public string? CheckExecutable(string file, NewExecutable nex, bool includeDebug) { // TODO: Don't read entire file - var data = nex.ReadArbitraryRange(); - if (data == null) + byte[]? data; + try + { + data = nex.ReadArbitraryRange(); + if (data == null) + return null; + } + catch + { + // Ignore errors reading ranges return null; + } // TODO: Figure out what NE section this lives in var neMatchSets = new List diff --git a/BinaryObjectScanner/Protection/Macrovision.SafeCast.cs b/BinaryObjectScanner/Protection/Macrovision.SafeCast.cs index cad31fc5..48905e21 100644 --- a/BinaryObjectScanner/Protection/Macrovision.SafeCast.cs +++ b/BinaryObjectScanner/Protection/Macrovision.SafeCast.cs @@ -52,9 +52,18 @@ namespace BinaryObjectScanner.Protection } // TODO: Don't read entire file - var data = nex.ReadArbitraryRange(); - if (data == null) + byte[]? data; + try + { + data = nex.ReadArbitraryRange(); + if (data == null) + return null; + } + catch + { + // Ignore errors reading ranges return null; + } var neMatchSets = new List { diff --git a/BinaryObjectScanner/Protection/RainbowSentinel.cs b/BinaryObjectScanner/Protection/RainbowSentinel.cs index 731a8d3b..c9d15068 100644 --- a/BinaryObjectScanner/Protection/RainbowSentinel.cs +++ b/BinaryObjectScanner/Protection/RainbowSentinel.cs @@ -41,9 +41,18 @@ namespace BinaryObjectScanner.Protection public string? CheckExecutable(string file, NewExecutable nex, bool includeDebug) { // TODO: Don't read entire file - var data = nex.ReadArbitraryRange(); - if (data == null) + byte[]? data; + try + { + data = nex.ReadArbitraryRange(); + if (data == null) + return null; + } + catch + { + // Ignore errors reading ranges return null; + } // TODO: Figure out what NE section this lives in var neMatchSets = new List