Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions BinaryObjectScanner/Scanner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -405,11 +405,13 @@ private ProtectionDictionary GetInternalProtections(string fileName, Stream stre
// If we're scanning archives
if (_scanArchives && wrapper is IExtractable extractable)
{
// Get the output path
string tempPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());

// If the extractable file itself fails
try
{
// Extract and get the output path
string tempPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
// Extract to the output path
Directory.CreateDirectory(tempPath);
_ = extractable.Extract(tempPath, _includeDebug);

Expand All @@ -426,7 +428,13 @@ private ProtectionDictionary GetInternalProtections(string fileName, Stream stre
// Append the values
protections.Append(subProtections);
}

}
catch (Exception ex)
{
if (_includeDebug) Console.Error.WriteLine(ex);
}
finally
{
// If temp directory cleanup fails
try
{
Expand All @@ -438,10 +446,6 @@ private ProtectionDictionary GetInternalProtections(string fileName, Stream stre
if (_includeDebug) Console.Error.WriteLine(ex);
}
}
catch (Exception ex)
{
if (_includeDebug) Console.Error.WriteLine(ex);
}
}

#endregion
Expand Down
Loading