diff --git a/BurnOutSharp.Builder/LinearExecutable.cs b/BurnOutSharp.Builder/LinearExecutable.cs index 43cd6242..caa74684 100644 --- a/BurnOutSharp.Builder/LinearExecutable.cs +++ b/BurnOutSharp.Builder/LinearExecutable.cs @@ -16,6 +16,20 @@ namespace BurnOutSharp.Builder /// Filled executable on success, null on error public static Executable ParseExecutable(byte[] data, int offset) { + // If the data is invalid + if (data == null) + return null; + + // If the offset is out of bounds + if (offset < 0 || offset >= data.Length) + return null; + + // Cache the current offset + int initialOffset = offset; + + // Create a new executable to fill + var executable = new Executable(); + // TODO: Implement LE/LX parsing return null; } @@ -31,6 +45,20 @@ namespace BurnOutSharp.Builder /// Filled executable on success, null on error public static Executable ParseExecutable(Stream data) { + // If the data is invalid + if (data == null) + return null; + + // If the offset is out of bounds + if (data.Position < 0 || data.Position >= data.Length) + return null; + + // Cache the current offset + int initialOffset = (int)data.Position; + + // Create a new executable to fill + var executable = new Executable(); + // TODO: Implement LE/LX parsing return null; } diff --git a/BurnOutSharp.Builder/NewExecutable.cs b/BurnOutSharp.Builder/NewExecutable.cs index 333fcdd8..9b03c52c 100644 --- a/BurnOutSharp.Builder/NewExecutable.cs +++ b/BurnOutSharp.Builder/NewExecutable.cs @@ -16,6 +16,20 @@ namespace BurnOutSharp.Builder /// Filled executable on success, null on error public static Executable ParseExecutable(byte[] data, int offset) { + // If the data is invalid + if (data == null) + return null; + + // If the offset is out of bounds + if (offset < 0 || offset >= data.Length) + return null; + + // Cache the current offset + int initialOffset = offset; + + // Create a new executable to fill + var executable = new Executable(); + // TODO: Implement NE parsing return null; } @@ -31,6 +45,20 @@ namespace BurnOutSharp.Builder /// Filled executable on success, null on error public static Executable ParseExecutable(Stream data) { + // If the data is invalid + if (data == null) + return null; + + // If the offset is out of bounds + if (data.Position < 0 || data.Position >= data.Length) + return null; + + // Cache the current offset + int initialOffset = (int)data.Position; + + // Create a new executable to fill + var executable = new Executable(); + // TODO: Implement NE parsing return null; } diff --git a/BurnOutSharp.Builder/PortableExecutable.cs b/BurnOutSharp.Builder/PortableExecutable.cs index e05663fc..ecce394b 100644 --- a/BurnOutSharp.Builder/PortableExecutable.cs +++ b/BurnOutSharp.Builder/PortableExecutable.cs @@ -16,6 +16,20 @@ namespace BurnOutSharp.Builder /// Filled executable on success, null on error public static Executable ParseExecutable(byte[] data, int offset) { + // If the data is invalid + if (data == null) + return null; + + // If the offset is out of bounds + if (offset < 0 || offset >= data.Length) + return null; + + // Cache the current offset + int initialOffset = offset; + + // Create a new executable to fill + var executable = new Executable(); + // TODO: Implement PE parsing return null; } @@ -31,6 +45,20 @@ namespace BurnOutSharp.Builder /// Filled executable on success, null on error public static Executable ParseExecutable(Stream data) { + // If the data is invalid + if (data == null) + return null; + + // If the offset is out of bounds + if (data.Position < 0 || data.Position >= data.Length) + return null; + + // Cache the current offset + int initialOffset = (int)data.Position; + + // Create a new executable to fill + var executable = new Executable(); + // TODO: Implement PE parsing return null; }