Skip to content

FileFormatException when opening a Package with over 4GB file on desktop #28955

Closed

Description

@ericstj

In order to compress a file over 2GB one must use a write-only ZipArchive, due to https://github.com/dotnet/corefx/issues/11669. When an entry is open for Write-only, the entry will never allocate space for the Zip64 extended information extra field in the local file header, since it doesn't know at the time the file is opened if it will need 64-bit lengths. As a result, files over 4GB written to ZipArchives will always use the DataDescriptor at the end of the entry to record their size.

When using this DataDescriptor we were failing to set the version needed to extract to indicate Zip64 was required, but this should have been done since we were using 64-bit lengths in the data descriptor which were defined in the ZIP64 version of the AppNote.txt.

Not setting the Zip64 version in the local header was causing WindowsBase.dll's ZipArchive implementation to reject our Zips. https://referencesource.microsoft.com/#WindowsBase/Base/MS/Internal/IO/Zip/ZipIOLocalFileDataDescriptor.cs,106

We should fix this in ZipArchiveEntry.

Activity

  1. self-assigned this
    on Mar 13, 2019
  2. transferred this issue fromdotnet/corefxon Feb 1, 2020
  3. added this to the 3.0 milestone on Feb 1, 2020
  4. ghost locked as resolved and limited conversation to collaborators on Dec 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions