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: CL 6811080 broke the ability to read a zip file #4393

Closed
gopherbot opened this issue Nov 15, 2012 · 6 comments
Closed

archive/zip: CL 6811080 broke the ability to read a zip file #4393

gopherbot opened this issue Nov 15, 2012 · 6 comments
Milestone

Comments

@gopherbot
Copy link

by mpvanlohuizen:

What steps will reproduce the problem?
If possible, include a link to a program on play.golang.org.
1. Download attached go and zip file.
2. Run the go program. 
3. It will panic:

What is the expected output?
The expected output is not to panic.

What do you see instead?
panic: zip: not a valid zip file

Which compiler are you using (5g, 6g, 8g, gccgo)?
6g

Which operating system are you using?
MacOS X 10.8.2

Which version are you using?  (run 'go version')
go version devel +f5c69f87ef34 Mon Nov 12 12:21:00 2012 +0100

Please provide any additional information below.
This bug was introduced with CL 6811080:
archive/zip: Fix bounds check panic for ZIP files with a truncated extra header.
from dave, reviewed by adg.

Attachments:

  1. testzip.go (379 bytes)
  2. core.zip (5222881 bytes)
@davecheney
Copy link
Contributor

Comment 1:

I'm taking a look now. For the record, the panic comes from the test program, not the
archive/zip package.

@davecheney
Copy link
Contributor

Comment 2:

That zip file contains 13 bytes of extra data, the first 4 bytes, and the following 5
bytes are consumed, leaving 4 bytes unconsumed. This was my fault, I wrote the logic
assuming that you need _more_ than 4 bytes of extra data, but in this case there is a
tag with a 0 length.
zip: tag 30805 size 0
What program created that zip file? Can you possibly recreate the core.zip file
containing only one file, so it can be used as a test file ?

Owner changed to @davecheney.

Status changed to Accepted.

@davecheney
Copy link
Contributor

Comment 3:

http://golang.org/cl/6854058

Labels changed: added priority-soon, removed priority-triage.

@mpvl
Copy link
Contributor

mpvl commented Nov 16, 2012

Comment 4:

Yes, sorry, the panic is in the test program.
The zip file was obtained from http://www.unicode.org/Public/cldr/22/core.zip.
I don't know which program they used to create it, but I do know this error does not
occur with most of their zip files, so I'm not sure how easy it would be to reproduce
with a smaller set.

@davecheney
Copy link
Contributor

Comment 5:

It should be fixed in the CL linked above.

@davecheney
Copy link
Contributor

Comment 6:

This issue was closed by revision 7ec76e2.

Status changed to Fixed.

@rsc rsc added this to the Go1.1 milestone Apr 14, 2015
@rsc rsc removed the go1.1 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants