diff --git a/BurnOutSharp.Builder/PortableExecutable.cs b/BurnOutSharp.Builder/PortableExecutable.cs index b3648ee7..63347126 100644 --- a/BurnOutSharp.Builder/PortableExecutable.cs +++ b/BurnOutSharp.Builder/PortableExecutable.cs @@ -715,7 +715,7 @@ namespace BurnOutSharp.Builder attributeCertificateTable.Add(entry); // Align to the 8-byte boundary - while (offset < data.Length - 1 && (offset % 8) != 0) + while (offset < endOffset - 1 && (offset % 8) != 0) _ = data.ReadByte(ref offset); } @@ -1866,7 +1866,7 @@ namespace BurnOutSharp.Builder attributeCertificateTable.Add(entry); // Align to the 8-byte boundary - while (data.Position < data.Length - 1 && (data.Position % 8) != 0) + while (data.Position < endOffset - 1 && (data.Position % 8) != 0) _ = data.ReadByteValue(); }