From: Brad Fitzpatrick Date: Mon, 6 Jan 2014 18:43:56 +0000 (-0800) Subject: archive/zip: fix bug reading zip64 files X-Git-Tag: go1.3beta1~1048 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=02a15e716519b71aca6b74a0a388b30e83892e08;p=gostls13.git archive/zip: fix bug reading zip64 files ZIP64 Extra records are variably sized, but we weren't capping our reading of the extra fields at its previously-declared size. No test because I don't know how to easily create such files and don't feel like manually construction one. But all existing tests pass, and this is "obviously correct" (queue laughter). Fixes #7069 R=golang-codereviews, iant CC=golang-codereviews https://golang.org/cl/48150043 --- diff --git a/src/pkg/archive/zip/reader.go b/src/pkg/archive/zip/reader.go index 116737337f..80ee03006f 100644 --- a/src/pkg/archive/zip/reader.go +++ b/src/pkg/archive/zip/reader.go @@ -253,7 +253,7 @@ func readDirectoryHeader(f *File, r io.Reader) error { } if tag == zip64ExtraId { // update directory values from the zip64 extra block - eb := readBuf(b) + eb := readBuf(b[:size]) if len(eb) >= 8 { f.UncompressedSize64 = eb.uint64() }