From 02a15e716519b71aca6b74a0a388b30e83892e08 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Mon, 6 Jan 2014 10:43:56 -0800 Subject: [PATCH] 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 --- src/pkg/archive/zip/reader.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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() } -- 2.48.1