Skip to content

Commit

Permalink
Add minimum size check for opening files
Browse files Browse the repository at this point in the history
0bytes -> exception, just use pk2 stored (min size)
  • Loading branch information
kwsch committed Feb 15, 2017
1 parent f001d4d commit f860bd3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion PKHeX.WinForms/MainWindow/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,9 @@ private void openQuick(string path, bool force = false)
string ext = Path.GetExtension(path);
FileInfo fi = new FileInfo(path);
if (fi.Length > 0x10009C && fi.Length != 0x380000)
WinFormsUtil.Error("Input file is too large.", path);
WinFormsUtil.Error("Input file is too large." + Environment.NewLine + $"Size: {fi.Length} bytes", path);
else if (fi.Length < 32)
WinFormsUtil.Error("Input file is too small." + Environment.NewLine + $"Size: {fi.Length} bytes", path);
else
{
byte[] input; try { input = File.ReadAllBytes(path); }
Expand Down

0 comments on commit f860bd3

Please sign in to comment.