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

archive/zip: FileHeader.Extra API is problematic #22520

dsnet opened this issue Nov 1, 2017 · 2 comments

archive/zip: FileHeader.Extra API is problematic #22520

dsnet opened this issue Nov 1, 2017 · 2 comments


Copy link

@dsnet dsnet commented Nov 1, 2017

The FileHeader.Extra field is used by the Writer to write the "extra" field for the local file header and the central-directory file header. This is problematic because the Go implementation assumes that the extra bytes used in the two headers are the same. While is this is often the case, it is not always true.

See and you will notice that it frequently describes a "Local-header version" and a "Central-header version", where the formats sometimes differ.

The Reader does not have this problem because it entirely ignores the local headers.

I haven't thought much about what the right action is moving forward, whether to deprecate this field or add new API. I just want to file this issue, so I remember to address it later.

@dsnet dsnet self-assigned this Nov 1, 2017
@dsnet dsnet added the NeedsFix label Nov 1, 2017
@dsnet dsnet added this to the Go1.11 milestone Nov 1, 2017
Copy link

@ianlancetaylor ianlancetaylor commented Jun 13, 2018

@dsnet This is currently set for the 1.11 milestone. Please update as appropriate. Thanks.

Copy link

@rsc rsc commented Oct 6, 2020

I suggest we add ExtraCentral []byte, where a writer treats nil to mean "same as Extra".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.