Merge pull request #83 from haykpetros/issue_80

Added additional check to make sure that data is properly copied to a…
This commit is contained in:
Adam Hathcock
2015-08-30 09:46:38 +01:00

View File

@@ -202,6 +202,10 @@ namespace SharpCompress
public static void WriteLittleEndian(byte[] array, int pos, short value)
{
byte[] newBytes = BitConverter.GetBytes(value);
if (!BitConverter.IsLittleEndian)
Array.Reverse(newBytes);
Array.Copy(newBytes, 0, array, pos, newBytes.Length);
}
@@ -234,6 +238,10 @@ namespace SharpCompress
public static void WriteLittleEndian(byte[] array, int pos, int value)
{
byte[] newBytes = BitConverter.GetBytes(value);
if (!BitConverter.IsLittleEndian)
Array.Reverse(newBytes);
Array.Copy(newBytes, 0, array, pos, newBytes.Length);
}