This project is read-only.


Malformed zip file should throw ZipException or BadReadException, not IOException


I think that a malformed zip file should throw ZipException or BadReadException when calling ZipFile.Read(). The following code throws an IOException with the message "An attempt was made to move the file pointer before the beginning of the file."
Stack Trace:
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.SeekCore(Int64 offset, SeekOrigin origin) at System.IO.FileStream.Seek(Int64 offset, SeekOrigin origin) at Ionic.Zip.ZipFile.ReadIntoInstance(ZipFile zf) at Ionic.Zip.ZipFile.Read(String fileName, TextWriter statusMessageWriter, Encoding encoding, EventHandler`1 readProgress)
string filePath = Path.GetTempFileName();
File.WriteAllText( filePath , "asdfasdf" );
string outputDirectory = Path.GetTempPath();
using ( ZipFile zipFile = ZipFile.Read( filePath ) )
 zipFile.ExtractAll( outputDirectory  ); }
Closed Jun 22, 2011 at 3:58 AM by Cheeso
fixed in changeset 79591. First binary to get this fix: v1.9.1.6


Cheeso wrote Jun 22, 2011 at 3:57 AM

I think you're right.

wrote Jun 22, 2011 at 3:58 AM

wrote Jun 22, 2011 at 3:58 AM

wrote Feb 22, 2013 at 2:43 AM

wrote May 16, 2013 at 1:31 PM