Skip to content

Central and local directory mismatch for file? #399

Closed

Description

@DavidHollman

Steps to reproduce

Sporadic, we're not sure how this happens.

Actual behavior

We have seen a handful of cases where a ZIP created using FastZIP is corrupt. If you try to open it in WinZip, apparently the ZIP file header is readable, but extracting at least some files fails like this:

1

And running ZipFile.TestArchive(true) on such a file will return false.

I am looking for advice on how to track down this problem. Would be glad to provide any other relevant details that might help.

We have no other processes except FastZip calls to read/write the ZIP file contents. So I highly doubt anything secondary is corrupting the file.

Version of SharpZipLib

1.2.0

Obtained from (only keep the relevant lines)

  • Package installed using NuGet

Activity

  1. piksel commented on Dec 30, 2019

    @piksel
    Member

    What is the real CRC32 of the file being compressed?
    You can use this python snippet to show the CRC of the file:

    cat header.json | python -c 'import sys;import zlib;print(hex(zlib.crc32(sys.stdin.read().encode())%(1<<32)))'

    It would seem as if the file changes content between being added as an entry and its content actually being written to the zip stream. If it only happens sporadically it might be due to buffer sizes and flushing.

  2. piksel commented on Dec 30, 2019

    @piksel
    Member

    Also, could you provide the output of

    unzip -Z -v -h bad_file.zip
    

    Or you can attach a bad file to this issue by dragging it to the comment textbox.

  3. added
    zip
    on Dec 30, 2019
  4. DavidHollman commented on Jan 9, 2020

    @DavidHollman
    Author

    @piksel I'm afraid I do not have the original header.json file that it was attempting to compress. This zipping operation is done by an app which manages the uncompressed source files in a temp folder so they were not preserved.

    I've attached the output of the unzip command.
    unzip.txt
    Alpha-108-Test-Project.zip

    I've also attached the ZIP file with the problem.

    Thanks for your help looking into this.

  5. DavidHollman commented on Jan 9, 2020

    @DavidHollman
    Author

    Also, in #398 (comment) it was mentioned that this issue is a variant of #398. If that is definitely the case, would downgrading to version 1.1 be a valid workaround until the issue is permanently fixed?

  6. piksel commented on Jan 10, 2020

    @piksel
    Member

    That should probably suffice. I will take a look. If it is the same problem then that would indeed fix it, but I'm not so sure that it is. They seem to touch the same areas, but I don't see how this could be caused by the same bug.

  7. self-assigned this
    on Jan 10, 2020
  8. DavidHollman commented on Jan 15, 2020

    @DavidHollman
    Author

    Thanks. I'll try 1.1 though since I can't reproduce this at will it will be hard to know if that definitely has avoided the issue.

  9. piksel commented on Aug 4, 2020

    @piksel
    Member

    The only issue I can see in the report is that the CRC for one file is different in the two headers. But without any clear way to reproduce this I'm going to close it. Hopefully it will be fixed in v1.3, but since we can't test it... 🤷‍♀️

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

Metadata

Metadata

Assignees

Labels

needs-reprozip

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions