CanSeek can throw exceptions

This commit is contained in:
Matt Nadareski
2024-12-02 14:43:40 -05:00
parent 027864aaa6
commit f092a4d2ea
2 changed files with 5 additions and 5 deletions

View File

@@ -165,14 +165,14 @@ namespace BinaryObjectScanner.FileType
else if (!File.Exists(file))
return protections;
// If the stream isn't seekable
if (!stream.CanSeek)
return protections;
// Read the file contents
byte[] fileContent = [];
try
{
// If the stream isn't seekable
if (!stream.CanSeek)
return protections;
stream.Seek(0, SeekOrigin.Begin);
fileContent = stream.ReadBytes((int)stream.Length);
if (fileContent == null)