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: handle extra bytes after the zip index #5228

Closed
gopherbot opened this issue Apr 6, 2013 · 6 comments
Closed

archive/zip: handle extra bytes after the zip index #5228

gopherbot opened this issue Apr 6, 2013 · 6 comments

Comments

@gopherbot
Copy link

@gopherbot gopherbot commented Apr 6, 2013

by meskio@sindominio.net:

What steps will reproduce the problem?
http://play.golang.org/p/69b8Bz5Les


What is the expected output?
[no output]


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



Which operating system are you using?
Debian GNU/Linux


Which version are you using?  (run 'go version')
go version devel +1d49ee511d95 Fri Apr 05 15:23:03 2013 -0700 linux/amd64


Please provide any additional information below.
Zip library should support some extra bytes after the index. See the attached file, it's
the same as used on the example at "Go Playground". archive/go can not open it
unless we strip it with 'zip -A'.

Attachments:

  1. foo.zip (221 bytes)
@bradfitz
Copy link
Contributor

@bradfitz bradfitz commented Apr 6, 2013

Comment 1:

Why?
We only need to open zip files that real programs make, not bad zip files that humans
make just to get error messages.
It's true that OS X's zip program attempts to open this anyway:
 unzip -l Downloads/foo.zip.crdownload
Archive:  Downloads/foo.zip.crdownload
warning [Downloads/foo.zip.crdownload]:  55 extra bytes at beginning or within zipfile
  (attempting to process anyway)
error [Downloads/foo.zip.crdownload]:  reported length of central directory is
  -55 bytes too long (Atari STZip zipfile?  J.H.Holm ZIPSPLIT 1.1
  zipfile?).  Compensating...
  Length     Date   Time    Name
 --------    ----   ----    ----
        8  04-06-13 07:55   foo
 --------                   -------
        8                   1 file
But I don't think we need to read it unless a popular zip program makes such bogus files.
@gopherbot
Copy link
Author

@gopherbot gopherbot commented Apr 6, 2013

Comment 2 by demizide:

If the zip spec allows something then a library implementing it should also allow it, no?
Also if you check the ml thread you'll see that he was having the problem with epub
files which I'd imagine real programs make.
@gopherbot
Copy link
Author

@gopherbot gopherbot commented Apr 7, 2013

Comment 3 by meskio@sindominio.net:

The example is a hand made file, but as demizide sais the problem comes from a real epub
file, see the attached file.

Attachments:

  1. Anatra all'arancia meccanica.epub (797696 bytes)
@bradfitz
Copy link
Contributor

@bradfitz bradfitz commented Apr 7, 2013

Comment 4:

Okay, if this is simply a case of us not following the spec (which part?) and there are
real-world files like this, it can be fixed.
I wasn't aware of the golang-nuts thread.  In the future, be sure to include all
relevant information in the bug report and don't assume those reading the bugs have been
following discussions elsewhere.

Status changed to Accepted.

@adg
Copy link
Contributor

@adg adg commented Apr 8, 2013

Comment 5:

https://golang.org/cl/8504044

Status changed to Started.

@adg
Copy link
Contributor

@adg adg commented Apr 8, 2013

Comment 6:

This issue was closed by revision bfcd2d1.

Status changed to Fixed.

@gopherbot gopherbot added fixed labels Apr 8, 2013
@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
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.