Skip to content

Commit

Permalink
Fix exception System.ArgumentException when checking file format (#481
Browse files Browse the repository at this point in the history
)

* Fix exception `System.ArgumentException` when checking file format

* update PR number
  • Loading branch information
shaopeng-gh authored Sep 9, 2021
1 parent becf484 commit fbcdacb
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/BinaryParsers/ElfBinary/ElfBinary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public static bool CanLoadBinary(Uri uri)
return ELFReader.CheckELFType(Path.GetFullPath(uri.LocalPath)) != Class.NotELF;
}
catch (IOException) { return false; }
catch (ArgumentException) { return false; }
catch (UnauthorizedAccessException) { return false; }
}

Expand Down
1 change: 1 addition & 0 deletions src/BinaryParsers/MachOBinary/MachOBinary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public static bool CanLoadBinary(Uri uri)
machOs: out _) != MachOResult.NotMachO;
}
catch (IOException) { return false; }
catch (ArgumentException) { return false; }
catch (UnauthorizedAccessException) { return false; }
}

Expand Down
1 change: 1 addition & 0 deletions src/BinaryParsers/PEBinary/PEBinary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ public static bool CanLoadBinary(Uri uri)
}
}
catch (IOException) { return false; }
catch (ArgumentException) { return false; }
catch (UnauthorizedAccessException) { return false; }
}

Expand Down
1 change: 1 addition & 0 deletions src/ReleaseHistory.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Unreleased

* BUGFIX: Fix exception `System.ArgumentException` when checking file format. [#481](https://github.com/microsoft/binskim/pull/481)
* BUGFIX: Change compiler report rule to report all modules in file. [#476](https://github.com/microsoft/binskim/pull/476)
* FEATURE: Add dialects to the reporting rules. [#475](https://github.com/microsoft/binskim/pull/475)
* BUGFIX: Fix exception `System.AccessViolationException` caused by trying to read data out of boundary. [#470](https://github.com/microsoft/binskim/pull/470)
Expand Down

0 comments on commit fbcdacb

Please sign in to comment.