]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.22] archive/zip: treat truncated EOCDR comment as an error
authorDamien Neil <dneil@google.com>
Tue, 14 May 2024 21:39:10 +0000 (14:39 -0700)
committerCarlos Amedee <carlos@golang.org>
Wed, 29 May 2024 23:37:37 +0000 (23:37 +0000)
commitcf501ac0c5fe351a8582d20b43562027927906e7
tree66e1af8e55af212cd126c5424c046c5699a4d340
parentcb55d1a0c8e37c4e5c3c45dc6e8fed8d76a18b90
[release-branch.go1.22] archive/zip: treat truncated EOCDR comment as an error

When scanning for an end of central directory record,
treat an EOCDR signature with a record containing a truncated
comment as an error. Previously, we would skip over the invalid
record and look for another one. Other implementations do not
do this (they either consider this a hard error, or just ignore
the truncated comment). This parser misalignment allowed
presenting entirely different archive contents to Go programs
and other zip decoders.

For #66869
Fixes #67554

Change-Id: I94e5cb028534bb5704588b8af27f1e22ea49c7c6
Reviewed-on: https://go-review.googlesource.com/c/go/+/585397
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
(cherry picked from commit 33d725e5758bf1fea62e6c77fc70b57a828a49f5)
Reviewed-on: https://go-review.googlesource.com/c/go/+/588796
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/archive/zip/reader.go
src/archive/zip/reader_test.go
src/archive/zip/testdata/comment-truncated.zip [new file with mode: 0644]