You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Issues reading AES Encrypted/Stored entries from Zip files #324
Have a Zip file containing entries which are AES encrypted with a compressionMethod of Stored, and try to read it with code such as
var zipFile = new ZipFile(testData)
{
Password = password
};
foreach (ZipEntry entry in zipFile)
{
if (!entry.IsFile) continue;
// Should be stored rather than deflated
Assert.That(entry.CompressionMethod, Is.EqualTo(CompressionMethod.Stored), "Entry should be stored");
using (var zis = zipFile.GetInputStream(entry))
{
byte[] buffer = new byte[8];
var bytesRead = zis.Read(buffer, 0, 8);
Assert.That(bytesRead, Is.EqualTo(8), "Should have read the correct number of bytes");
}
}
Expected behavior
The data should be read.
Actual behavior
You get a System.IndexOutOfRangeException thrown from ZipAESTransform.TransformBlock() (looks like ZipAESStream does an inline transform on the buffer you pass to Read(), and falls over if the buffer is smaller than the AES block size?).
Also, if you pass a 16 byte buffer to ZipInputStream.Read(), it will return a read count of 16, even if you have asked for 8 bytes, which seems problematic to me?
Activity
Merge PR icsharpcode#331: Change ZipAESStream to handle reads of less…