Skip to content

Commit 9a01c8d

Browse files
committed
More adjustments and fixes for Zip64
1 parent 17c3ed3 commit 9a01c8d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Zip/ZipEntry.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ public int Version
576576
}
577577
else {
578578
int result = 10;
579-
if ( LocalHeaderRequiresZip64 ) {
579+
if ( CentralHeaderRequiresZip64 ) {
580580
result = ZipConstants.VersionZip64;
581581
}
582582
else if (CompressionMethod.Deflated == method) {
@@ -647,7 +647,7 @@ public bool LocalHeaderRequiresZip64
647647
// TODO: A better estimation of the true limit based on compression overhead should be used
648648
// to determine when an entry should use Zip64.
649649
result =
650-
((this.size >= uint.MaxValue) || (trueCompressedSize >= uint.MaxValue) || (this.offset >= uint.MaxValue)) &&
650+
((this.size >= uint.MaxValue) || (trueCompressedSize >= uint.MaxValue)) &&
651651
((versionToExtract == 0) || (versionToExtract >= ZipConstants.VersionZip64));
652652
}
653653

@@ -661,7 +661,7 @@ public bool LocalHeaderRequiresZip64
661661
public bool CentralHeaderRequiresZip64
662662
{
663663
get {
664-
return LocalHeaderRequiresZip64;
664+
return LocalHeaderRequiresZip64 || (offset >= uint.MaxValue);
665665
}
666666
}
667667

@@ -871,7 +871,7 @@ internal void ProcessExtraData(bool localHeader)
871871
compressedSize = (ulong)extraData.ReadLong();
872872
}
873873

874-
if ( !localHeader && (offset == -1) ) {
874+
if ( !localHeader && (offset == uint.MaxValue) ) {
875875
offset = extraData.ReadLong();
876876
}
877877
}

0 commit comments

Comments
 (0)