Skip to content

Commit

Permalink
When looking for Zip64CentralDirLocatorSignature, take account of the…
Browse files Browse the repository at this point in the history
… blocks fixed size. refs icsharpcode#403/icsharpcode#375
  • Loading branch information
Numpsy committed Jan 7, 2020
1 parent 749e025 commit baed5f2
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/ICSharpCode.SharpZipLib/Zip/ZipFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3422,8 +3422,16 @@ private void ReadEntries()
}

// #357 - always check for the existance of the Zip64 central directory.
long locatedZip64EndOfCentralDir = LocateBlockWithSignature(ZipConstants.Zip64CentralDirLocatorSignature, locatedEndOfCentralDir, 0, 0x1000);
if (locatedZip64EndOfCentralDir < 0)
// #403 - Take account of the fixed size of the locator when searching.
// Subtract from locatedEndOfCentralDir so that the endLocation is the location of EndOfCentralDirectorySignature,
// rather than the data following the signature.
long locatedZip64EndOfCentralDirLocator = LocateBlockWithSignature(
ZipConstants.Zip64CentralDirLocatorSignature,
locatedEndOfCentralDir - 4,
ZipConstants.Zip64EndOfCentralDirectoryLocatorSize,
0);

if (locatedZip64EndOfCentralDirLocator < 0)
{
if (requireZip64)
{
Expand Down

0 comments on commit baed5f2

Please sign in to comment.