Crash in ZipEntry.OpenReader() when not saved to file

Jun 30, 2009 at 10:58 AM

Hey there!

In the newest version 1.8 of your (really brilliant) Zip-Library, I got a crash when I call one of the following methods on a ZipFile which was created in memory:

var zip = new ZipFile();
var stream = zip.Entries[0].OpenReader();  // you could also call zip.Entries[0].Extract(...)

Exception Stacktrace

bei Ionic.Zip.ZipEntry.SetFdpLoh()\r\n bei Ionic.Zip.ZipEntry.get_FileDataPosition()
bei Ionic.Zip.ZipEntry.InternalOpenReader(String password)
bei Ionic.Zip.ZipEntry.OpenReader()

If I save the ZipFile to a file, it works. If I save it to a stream (MemoryStream), it crashes too.

Is this by design or is there a problem?

Thanks for your help!


Jun 30, 2009 at 1:35 PM
Edited Jun 30, 2009 at 1:38 PM

Hello Forian,

I think it is both:  it is by design that what you tried does not work, and there is a problem in DotNetZip in that it does not return a proper exception.

It looks like you haven't actually called Save between the call to AddDirectory() and the call to OpenReader() or Extract() - is that correct?

The library is not designed to handle that, so I would expect an error.  On the other hand, it should not throw a random exception.  It should throw something with a message like "You must call ZipFile.Save before attempting to extract an entry."

Jun 30, 2009 at 1:36 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Jul 1, 2009 at 12:46 PM

Yes that's right, I haven't called Save. Thank you for your reply!