Skip to content

Commit 03016f3

Browse files
committed
Try 16
1 parent 778064b commit 03016f3

File tree

5 files changed

+12
-5
lines changed

5 files changed

+12
-5
lines changed

BinaryObjectScanner/FileType/LDSCRYPT.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ public class LDSCRYPT : DetectableBase
1515
{
1616
try
1717
{
18-
byte[] magic = stream.ReadBytes(16);
18+
int bytesToRead = (int)Math.Min(16, stream.Length);
19+
byte[] magic = stream.ReadBytes(bytesToRead);
20+
1921
if (magic.StartsWith(new byte?[] { 0x4C, 0x44, 0x53, 0x43, 0x52, 0x59, 0x50, 0x54 }))
2022
return "Link Data Security encrypted file";
2123
}

BinaryObjectScanner/FileType/RealArcadeInstaller.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ public class RealArcadeInstaller : DetectableBase
1717
{
1818
try
1919
{
20-
byte[] magic = stream.ReadBytes(16);
20+
int bytesToRead = (int)Math.Min(16, stream.Length);
21+
byte[] magic = stream.ReadBytes(bytesToRead);
2122

2223
// RASGI2.0
2324
// Found in the ".rgs" files in IA item "Nova_RealArcadeCD_USA".

BinaryObjectScanner/FileType/RealArcadeMezzanine.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ public class RealArcadeMezzanine : DetectableBase
1717
{
1818
try
1919
{
20-
byte[] magic = stream.ReadBytes(16);
20+
int bytesToRead = (int)Math.Min(16, stream.Length);
21+
byte[] magic = stream.ReadBytes(bytesToRead);
2122

2223
// XZip2.0
2324
// Found in the ".mez" files in IA item "Nova_RealArcadeCD_USA".

BinaryObjectScanner/FileType/SFFS.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ public class SFFS : DetectableBase
1717
{
1818
try
1919
{
20-
byte[] magic = stream.ReadBytes(16);
20+
int bytesToRead = (int)Math.Min(16, stream.Length);
21+
byte[] magic = stream.ReadBytes(bytesToRead);
22+
2123
if (magic.StartsWith(new byte?[] { 0x53, 0x46, 0x46, 0x53 }))
2224
return "StarForce Filesystem Container";
2325
}

BinaryObjectScanner/Scanner.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,8 @@ private ProtectionDictionary GetInternalProtections(string fileName, Stream stre
290290
byte[] magic;
291291
try
292292
{
293-
magic = stream.ReadBytes(16);
293+
int bytesToRead = (int)Math.Min(16, stream.Length);
294+
magic = stream.ReadBytes(bytesToRead);
294295
stream.Seek(0, SeekOrigin.Begin);
295296
}
296297
catch (Exception ex)

0 commit comments

Comments
 (0)