We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The following program crashes with the panic:
package main import ( "archive/zip" "bytes" "io/ioutil" ) func main() { headers := []zip.FileHeader{ {Name:"0", Method:8}, {Name:"1", Method:8}, } contents := [][]byte{ []byte("a"), []byte("b"), } buf := new(bytes.Buffer) w := zip.NewWriter(buf) for i, h := range headers { w1, err := w.CreateHeader(&h) if err != nil { panic(err) } _, err = w1.Write(contents[i]) if err != nil { panic(err) } } err := w.Close() if err != nil { panic(err) } z1, err := zip.NewReader(bytes.NewReader(buf.Bytes()), int64(len(buf.Bytes()))) if err != nil { panic(err) } var headers1 []zip.FileHeader var contents1 [][]byte for _, f := range z1.File { r, err := f.Open() if err != nil { panic(err) } c, err := ioutil.ReadAll(r) if err != nil { panic(err) } headers1 = append(headers1, f.FileHeader) contents1 = append(contents1, c) r.Close() } }
panic: zip: checksum error goroutine 1 [running]: main.main() zip.go:48 +0x8f8
go version devel +b0532a9 Mon Jun 8 05:13:15 2015 +0000 linux/amd64
The text was updated successfully, but these errors were encountered:
I think this is dup of #11144 (FileHeader is shared between files).
Sorry, something went wrong.
No branches or pull requests
The following program crashes with the panic:
go version devel +b0532a9 Mon Jun 8 05:13:15 2015 +0000 linux/amd64
The text was updated successfully, but these errors were encountered: