Skip to content

Commit a60c221

Browse files
committed
#403 / #375 - When looking for Zip64CentralDirLocatorSignature, take account of the blocks fixed size.
1 parent 749e025 commit a60c221

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/ICSharpCode.SharpZipLib/Zip/ZipFile.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3422,8 +3422,16 @@ private void ReadEntries()
34223422
}
34233423

34243424
// #357 - always check for the existance of the Zip64 central directory.
3425-
long locatedZip64EndOfCentralDir = LocateBlockWithSignature(ZipConstants.Zip64CentralDirLocatorSignature, locatedEndOfCentralDir, 0, 0x1000);
3426-
if (locatedZip64EndOfCentralDir < 0)
3425+
// #403 - Take account of the fixed size of the locator when searching.
3426+
// Subtract from locatedEndOfCentralDir so that the endLocation is the location of EndOfCentralDirectorySignature,
3427+
// rather than the data following the signature.
3428+
long locatedZip64EndOfCentralDirLocator = LocateBlockWithSignature(
3429+
ZipConstants.Zip64CentralDirLocatorSignature,
3430+
locatedEndOfCentralDir - sizeof(int),
3431+
ZipConstants.Zip64EndOfCentralDirectoryLocatorSize,
3432+
0);
3433+
3434+
if (locatedZip64EndOfCentralDirLocator < 0)
34273435
{
34283436
if (requireZip64)
34293437
{

0 commit comments

Comments
 (0)