haf / DotNetZip.Semverd

Please use System.IO.Compression! A fork of the DotNetZip project without signing with a solution that compiles cleanly. This project aims to follow semver to avoid versioning conflicts. DotNetZip is a FAST, FREE class library and toolset for manipulating zip files. Use VB, C# or any .NET language to easily create, extract, or update zip files.
Other
545 stars 218 forks source link

zip file extracts without problems in 7zip, DotNetZip fails to open the archive (BZ_DATA_ERROR) #267

Open basprins opened 1 year ago

basprins commented 1 year ago

We are facing an issue with DotNetZip. We create zip files and extract them on user interaction. We received an issue from a customer that extracting the zip failed.

We received the zip file, and tried to extract it. The problem reproduces. DotNetZip throws an exception


System.Exception : BZ_DATA_ERROR
   at Ionic.BZip2.BZip2InputStream.SetupBlock()
   at Ionic.BZip2.BZip2InputStream.init()
   at Ionic.Zip.ZipEntry.GetExtractDecompressor(Stream input2)
   at Ionic.Zip.ZipEntry.ExtractAndCrc(Stream archiveStream, Stream targetOutput, Int16 compressionMethod, Int64 compressedFileDataSize, Int64 uncompressedSize)
   at Ionic.Zip.ZipEntry.ExtractToStream(Stream archiveStream, Stream output, EncryptionAlgorithm encryptionAlgorithm, Int32 expectedCrc32)
   at Ionic.Zip.ZipEntry.InternalExtractToBaseDir(String baseDir, String password, ZipContainer zipContainer, ZipEntrySource zipEntrySource, String fileName)
   at Ionic.Zip.ZipFile._InternalExtractAll(String path, Boolean overrideExtractExistingProperty)

We can open the archive in 7zip, and extract it without any problem.

We create the archives as follows


            using var archive = new ZipFile(mainArchivePath);
            archive.CompressionLevel = Ionic.Zlib.CompressionLevel.BestSpeed; 
            archive.CompressionMethod = CompressionMethod.BZip2;

Is there experience with this problem? Any hints?

I attached the zip archive in case you would be interested to reproduce. We removed all files except the one file that gives this problem.

PS: The functionality which is zipping/unzipping is extensively world wide. We haven't received this issue before. So it occurs very rarely.

SYSTEM - SingleFile.zip