Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix writing zip64's offset #1206

Merged
merged 1 commit into from
Jun 18, 2023
Merged

Fix writing zip64's offset #1206

merged 1 commit into from
Jun 18, 2023

Conversation

dwijnand
Copy link
Member

@dwijnand dwijnand commented Jun 17, 2023

ZipFileSystem's sync writes all the zip file entries, followed by the
central directory ("cen") entries, counting all the written bytes,
which it passes to write the end ("end") entry. ZipCentralDir's dump
skips writing the file entries and only writes the cen entries, which
means that its written is missing all the bytes of the file entries.
Fortunately that missing value is recorded in the end as the offset
where the cen entries start, so we fix written with cenoff. This
bug only impacted writing zip64 jars, through ZipCentralDir.

@lightbend-cla-validator

This comment was marked as resolved.

ZipFileSystem's `sync` writes all the zip file entries, followed by the
central directory ("cen") entries, counting the all `written` bytes,
which it passes to write the end ("end") entry.  ZipCentralDir's `dump`
skips writing the file entries and only writes the cen entries, which
means that its `written` is missing all the bytes of the file entries.
Fortunately that missing value is recorded in the `end` as the offset
where the cen entries start, so we fix `written` with `cenoff`.  This
bug only impacted writing zip64 jars, through ZipCentralDir.
@dwijnand dwijnand marked this pull request as ready for review June 17, 2023 13:35
Copy link
Member

@eed3si9n eed3si9n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @dwijnand!

@eed3si9n eed3si9n merged commit 0646b30 into sbt:develop Jun 18, 2023
@dwijnand dwijnand deleted the zip-merge-fix branch June 19, 2023 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants