From 6ef3be4b5cd42ae391768b4360b00778f7e42094 Mon Sep 17 00:00:00 2001 From: Kenneth Skovhede Date: Thu, 9 Mar 2017 11:32:20 +0100 Subject: [PATCH 1/2] Fixed writing correct headers in zip archives --- src/SharpCompress/Common/Zip/Headers/DirectoryEntryHeader.cs | 4 ++-- src/SharpCompress/Common/Zip/Headers/LocalEntryHeader.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/SharpCompress/Common/Zip/Headers/DirectoryEntryHeader.cs b/src/SharpCompress/Common/Zip/Headers/DirectoryEntryHeader.cs index 25fb06be2..89c4e280a 100644 --- a/src/SharpCompress/Common/Zip/Headers/DirectoryEntryHeader.cs +++ b/src/SharpCompress/Common/Zip/Headers/DirectoryEntryHeader.cs @@ -70,8 +70,8 @@ internal override void Write(BinaryWriter writer) writer.Write(LastModifiedTime); writer.Write(LastModifiedDate); writer.Write(Crc); - writer.Write(CompressedSize); - writer.Write(UncompressedSize); + writer.Write((uint)CompressedSize); + writer.Write((uint)UncompressedSize); byte[] nameBytes = EncodeString(Name); writer.Write((ushort)nameBytes.Length); diff --git a/src/SharpCompress/Common/Zip/Headers/LocalEntryHeader.cs b/src/SharpCompress/Common/Zip/Headers/LocalEntryHeader.cs index 1d0720710..4665ed299 100644 --- a/src/SharpCompress/Common/Zip/Headers/LocalEntryHeader.cs +++ b/src/SharpCompress/Common/Zip/Headers/LocalEntryHeader.cs @@ -55,8 +55,8 @@ internal override void Write(BinaryWriter writer) writer.Write(LastModifiedTime); writer.Write(LastModifiedDate); writer.Write(Crc); - writer.Write(CompressedSize); - writer.Write(UncompressedSize); + writer.Write((uint)CompressedSize); + writer.Write((uint)UncompressedSize); byte[] nameBytes = EncodeString(Name); From 81ab5c189db2f83ed56d03157b9f0b6aae2affeb Mon Sep 17 00:00:00 2001 From: Kenneth Skovhede Date: Thu, 9 Mar 2017 11:34:24 +0100 Subject: [PATCH 2/2] Fixed writing correct headers in zip archives --- src/SharpCompress/Common/Zip/Headers/DirectoryEntryHeader.cs | 2 +- src/SharpCompress/Common/Zip/Headers/LocalEntryHeader.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/SharpCompress/Common/Zip/Headers/DirectoryEntryHeader.cs b/src/SharpCompress/Common/Zip/Headers/DirectoryEntryHeader.cs index 89c4e280a..3b50d1189 100644 --- a/src/SharpCompress/Common/Zip/Headers/DirectoryEntryHeader.cs +++ b/src/SharpCompress/Common/Zip/Headers/DirectoryEntryHeader.cs @@ -70,7 +70,7 @@ internal override void Write(BinaryWriter writer) writer.Write(LastModifiedTime); writer.Write(LastModifiedDate); writer.Write(Crc); - writer.Write((uint)CompressedSize); + writer.Write((uint)CompressedSize); writer.Write((uint)UncompressedSize); byte[] nameBytes = EncodeString(Name); diff --git a/src/SharpCompress/Common/Zip/Headers/LocalEntryHeader.cs b/src/SharpCompress/Common/Zip/Headers/LocalEntryHeader.cs index 4665ed299..2e311cc86 100644 --- a/src/SharpCompress/Common/Zip/Headers/LocalEntryHeader.cs +++ b/src/SharpCompress/Common/Zip/Headers/LocalEntryHeader.cs @@ -55,8 +55,8 @@ internal override void Write(BinaryWriter writer) writer.Write(LastModifiedTime); writer.Write(LastModifiedDate); writer.Write(Crc); - writer.Write((uint)CompressedSize); - writer.Write((uint)UncompressedSize); + writer.Write((uint)CompressedSize); + writer.Write((uint)UncompressedSize); byte[] nameBytes = EncodeString(Name);