-
Notifications
You must be signed in to change notification settings - Fork 17.4k
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/tar: incorrectly claims huge file size #12434
Comments
I believe tar is working properly here. A check for hdr.Size should occur after an attempt to read the data first. In this situation, the header properly encodes a size of 1015915 bytes, but the tar format itself is bad in that it doesn't contain any data after the header. This is an example of a "valid" tar file that is prematurely truncated. Modifying the example to include a read, properly returns an io.ErrUnexpectedEOF due to a truncated stream. Furthermore, if we modify the example to include a reader that artificially extends the file to a sufficient length, this reads properly. Even furthermore, appending 1987x (512B) blocks of all zeros to the tar data makes it properly parsible by the GNU version of tar. I recommend that we close this as "working as intended". |
If the package is calling panic, I don't think it's working as intended. |
The package isn't calling panic, the test code is calling panic. |
Whoops, thanks. Closing. @dvyukov , feel free to reopen if you disagree. |
The following program crashes:
Since tar is not compressing and input size is 512, this looks bogus.
go version go1.5 linux/amd64
The text was updated successfully, but these errors were encountered: