]> Cypherpunks.ru repositories - gostls13.git/commit
archive/zip: fail fast if UncompressedSize64 < nread
authorMeng Zhuo <mzh@golangcn.org>
Wed, 24 Nov 2021 08:33:14 +0000 (16:33 +0800)
committermzh <mzh@golangcn.org>
Mon, 11 Apr 2022 01:24:31 +0000 (01:24 +0000)
commitb6fb3af6af9835962ce1de1e1afcaa46726a654e
treee14ae26af78e939d81f384fba7d5f770edb944c9
parenta10f158d6fdac7c6130b816a00ff14cc22619d2e
archive/zip: fail fast if UncompressedSize64 < nread

The zip reader checks that the uncompressed file size is valid
after all compressed files read until EOF.
However in between reading each file, there could have already
been an overflow where nread > UncompressedSize64 hence this
change will now return ErrFormat in such situations.

Fixes #49791

Change-Id: If3584a57d173de6a97bf35c07d2a99ff6972f820
Reviewed-on: https://go-review.googlesource.com/c/go/+/366854
Trust: mzh <mzh@golangcn.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
src/archive/zip/reader.go
src/archive/zip/reader_test.go