From 582cb3f28ca412d4e379af2ffacad6fa63c25d30 Mon Sep 17 00:00:00 2001 From: Baptist BENOIST Date: Mon, 27 Apr 2015 20:35:13 +0200 Subject: [PATCH] Closes #41 - Do not fail when local header compressed size equals to 0 As extracting some "valid" ZIP files was not possible... Example ZIP file failing before the fix: http://www.cmake.org/files/v3.2/cmake-3.2.2-win32-x86.zip Also related to: * https://github.com/icsharpcode/SharpZipLib/issues/41 * http://community.sharpdevelop.net/forums/t/12404.aspx --- src/Zip/ZipFile.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Zip/ZipFile.cs b/src/Zip/ZipFile.cs index 6a71cae5c..8a6555290 100644 --- a/src/Zip/ZipFile.cs +++ b/src/Zip/ZipFile.cs @@ -1258,7 +1258,8 @@ long TestLocalHeader(ZipEntry entry, HeaderTest tests) } if (compressedSize != entry.CompressedSize && - compressedSize != 0xFFFFFFFF && compressedSize != -1) { + compressedSize != 0xFFFFFFFF && compressedSize != -1 && + compressedSize != 0) { throw new ZipException( string.Format("Compressed size mismatch between central header({0}) and local header({1})", entry.CompressedSize, compressedSize));