Skip to content

ICSharpCode.SharpZipLib.Zip.ZipException: Wrong Central Directory signature #356

Description

@DmitriyKirakosyan

File to test: https://dl.google.com/android/repository/sys-img/android-wear/x86-P_r02.zip.
SharpZipLib fails to unzip this file, while Windows10 is able to do it using Extract All... menu item.

Steps to reproduce

  1. Download the test file;
  2. Try to unzip it using SharpZipLib;
  3. Observe the Wrong Central Directory signature error.

Version of SharpZipLib

1.1.0

Obtained from (only keep the relevant lines)

  • Package installed using NuGet

Activity

  1. piksel commented on Jun 18, 2019

    @piksel
    Member

    Confirmed. This is due to the fact that the file has a Zip64 Central Directory, while not using any Zip64 extensions. It also contains a non-zip64 CD, but it seems to be corrupt.

    The way SharpZipLib detects whether to use Zip64 is if any of the fields are set to all 1s (0xffff etc), and only then tries to find the Zip64 signature.
    This means that unzip and other programs that just tries to find both headers at once works fine, while SharpZipLib (albeit correctly) complains about the invalid Central Directory.

    We should probably attempt to find the Zip64 signature at once as well, this would make the library work more like most other zip-implementations and handle non-compliant zip files better.

  2. self-assigned this
    on Jun 18, 2019
  3. added
    zipRelated to ZIP file format
    and removed on Jun 18, 2019
  4. piksel commented on Jun 18, 2019

    @piksel
    Member

    I made a new issue #357 for the root cause to link this and other issues into.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

zipRelated to ZIP file format

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions