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

Unknown extra fields are not merged correctly when loading. #505

Closed
hainesr opened this issue Nov 15, 2021 · 0 comments · Fixed by #507
Closed

Unknown extra fields are not merged correctly when loading. #505

hainesr opened this issue Nov 15, 2021 · 0 comments · Fixed by #507
Assignees
Labels
Milestone

Comments

@hainesr
Copy link
Member

hainesr commented Nov 15, 2021

When loading extra fields from both the central directory and local headers, unknown fields are not merged correctly. Currently they are appended, which means that we end up with the two versions stuck together.

This potentially causes all sorts of subtle issues, such as the local header size being miscalculated, and so on.

@hainesr hainesr added the bug label Nov 15, 2021
@hainesr hainesr added this to the 3.0 milestone Nov 15, 2021
@hainesr hainesr self-assigned this Nov 15, 2021
hainesr added a commit to hainesr/rubyzip that referenced this issue Nov 16, 2021
When loading extra fields from both the central directory and local headers,
unknown fields were not merged correctly. They were being appended, which
means that we end up with the two versions stuck together - in some
cases duplicating the field completely.

This broke all kinds of things (like calculating the size of a local
header) in subtle ways.

This commit fixes this by implementing a new `Unknown` extra field type,
and making sure that when reading local and central extra fields they
are stored and preserved correctly. We cannot assume the unknown fields
use the same data in the local and central headers.

Fixes rubyzip#505.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant