This project is read-only.

BadReadException on byte[1179648]

public class Program
    public static void Main(string[] args)
        var source = new FileInfo("foo.txt");
        using (var writer = source.CreateText())
            writer.Write(new string('a', 1179648));

        var target = new FileInfo(Path.ChangeExtension(source.FullName, "zip"));
        var folder = new DirectoryInfo(Path.ChangeExtension(source.FullName, null));

        if (target.Exists)

        if (folder.Exists)

        using (var zip = new ZipFile(target.FullName))
            zip.AddFile(source.FullName, string.Empty);

        using (var zip = new ZipFile(target.FullName))
Unhandled Exception: Ionic.Zip.BadReadException: bad read of entry foo.txt from compressed archive.
   at Ionic.Zip.ZipEntry._CheckRead(Int32 nbytes)
   at Ionic.Zip.ZipEntry.ExtractOne(Stream output)
   at Ionic.Zip.ZipEntry.InternalExtract(String baseDir, Stream outstream, String password)
   at Ionic.Zip.ZipFile._InternalExtractAll(String path, Boolean overrideExtractExistingProperty)
   at Ionic.Zip.ZipFile.ExtractAll(String path)
   at ConsoleApplication1.Program.Main(String[] args) in C:\ZipDemo\ConsoleApplication1\ConsoleApplication1\Program.cs:line 32

file attachments


Steam wrote Mar 11, 2013 at 1:59 PM

Was able to replicate this issue. Code works well with v1.9. Attached sample code with working version (using v1.9 of DotNetZip)

VS2012 used for testing.

wrote Apr 2, 2013 at 10:33 PM

wrote May 23, 2013 at 7:47 AM

wrote Aug 20, 2013 at 4:05 PM

ichris wrote Aug 20, 2013 at 4:06 PM

This is probably a duplicate of