]> Cypherpunks repositories - gostls13.git/commit
archive/zip: use base offset 0 if it has a valid entry
authorIan Lance Taylor <iant@golang.org>
Wed, 11 Jan 2023 20:17:20 +0000 (12:17 -0800)
committerGopher Robot <gobot@golang.org>
Fri, 20 Jan 2023 01:04:11 +0000 (01:04 +0000)
commit78558d5e10a30c88c0b564e69963a0f0188c1dbd
treee1e78093a2ecfc8afce1735fb2d220f47d2e565a
parent5454834f011c019ca32d844d26d469cd47f407ad
archive/zip: use base offset 0 if it has a valid entry

In CL 408734 we introduced a fall back to base offset 0 if reading a
directory entry at the computed base offset failed. We have now found
a file in the wild for which the computed base offset is incorrect,
but happens to refer to a valid directory entry. In this CL, we change
the fallback such that if the first directory header relative to base
offset 0 is valid, we just use base offset 0.

Change-Id: Ia9ace20c1065d1f651035f16f7d91d741ab1dbf4
Reviewed-on: https://go-review.googlesource.com/c/go/+/461598
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
src/archive/zip/reader.go
src/archive/zip/reader_test.go
src/archive/zip/testdata/test-badbase.zip [new file with mode: 0644]