aboutsummaryrefslogtreecommitdiff
path: root/src/compress/gzip/gunzip_test.go
AgeCommit message (Collapse)Author
2022-07-12[release-branch.go1.17] compress/gzip: fix stack exhaustion bug in Reader.ReadTatiana Bradley
Replace recursion with iteration in Reader.Read to avoid stack exhaustion when there are a large number of files. Fixes CVE-2022-30631 Fixes #53717 Updates #53168 Change-Id: I47d8afe3f2d40b0213ab61431df9b221794dbfe0 Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1455673 Reviewed-by: Roland Shoemaker <bracewell@google.com> Reviewed-by: Julie Qiu <julieqiu@google.com> (cherry picked from commit cf498969c8a0bae9d7a24b98fc1f66c824a4775d) Reviewed-on: https://go-review.googlesource.com/c/go/+/417071 Reviewed-by: Heschi Kreinick <heschi@google.com> Run-TryBot: Michael Knyszek <mknyszek@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2020-10-20all: update references to symbols moved from io/ioutil to ioRuss Cox
The old ioutil references are still valid, but update our code to reflect best practices and get used to the new locations. Code compiled with the bootstrap toolchain (cmd/asm, cmd/dist, cmd/compile, debug/elf) must remain Go 1.4-compatible and is excluded. Also excluded vendored code. For #41190. Change-Id: I6d86f2bf7bc37a9d904b6cee3fe0c7af6d94d5b1 Reviewed-on: https://go-review.googlesource.com/c/go/+/263142 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2019-11-21all: base64-encode binaries that will cause Apple notarization to failAndrew
Starting with macOS 10.15 (Catalina), Apple now requires all software distributed outside of the App Store to be notarized. Any binaries we distribute must abide by a strict set of requirements like code-signing and having a minimum target SDK of 10.9 (amongst others). Apple’s notarization service will recursively inspect archives looking to find notarization candidate binaries. If it finds a binary that does not meet the requirements or is unable to decompress an archive, it will reject the entire distribution. From cursory testing, it seems that the service uses content sniffing to determine file types, so changing the file extension will not work. There are some binaries and archives included in our distribution that are being detected by Apple’s service as potential candidates for notarization or decompression. As these are files used by tests and some are intentionally invalid, we don’t intend to ever make them compliant. As a workaround for this, we base64-encode any binaries or archives that Apple’s notarization service issues a warning for, as these warnings will become errors in January 2020. Updates #34986 Change-Id: I106fbb6227b61eb221755568f047ee11103c1680 Reviewed-on: https://go-review.googlesource.com/c/go/+/208118 Run-TryBot: Andrew Bonventre <andybons@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-08-31compress/flate: always return uncompressed data in the event of errorJoe Tsai
In the event of an unexpected error, we should always flush available decompressed data to the user. Fixes #16924 Change-Id: I0bc0824c3201f3149e84e6a26e3dbcba72a1aae5 Reviewed-on: https://go-review.googlesource.com/28216 Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-04-14compress/gzip: fix Reader to properly check FHCRCJoe Tsai
RFC 1952, section 3.2.3 says: >>> If FHCRC is set, a CRC16 for the gzip header is present, immediately before the compressed data. The CRC16 consists of the two least significant bytes of the CRC32 for all bytes of the gzip header up to and not including the CRC16. <<< Thus, instead of computing the CRC only over the first 10 bytes of the header, we compute it over the whole header (minus CRC16). Fixes #15070 Change-Id: I55703fd30b535b12abeb5e3962d4da0a86ed615a Reviewed-on: https://go-review.googlesource.com/21466 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-04-02compress/gzip: fix Reader.ResetJoe Tsai
Rather than specifying every field that should be cleared in Reset, it is better to just zero the entire struct and only preserve or set the fields that we actually care about. This ensures that the Header field is reset for the next use. Fixes #15077 Change-Id: I41832e506d2d64c62b700aa1986e7de24a577511 Reviewed-on: https://go-review.googlesource.com/21465 Run-TryBot: Joe Tsai <joetsai@digital-static.net> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-02compress/gzip: cleanup gzip packageJoe Tsai
Changes made: * Reader.flg is not used anywhere else other than readHeader and does not need to be stored. * Store Reader.digest and Writer.digest as uint32s rather than as a hash.Hash32 and use the crc32.Update function instead. This simplifies initialization logic since the zero value of uint32 is the initial CRC-32 value. There are no performance detriments to doing this since the hash.Hash32 returned by crc32 simply calls crc32.Update as well. * s/[0:/[:/ Consistently use shorter notation for slicing. * s/RFC1952/RFC 1952/ Consistently use RFC notation. Change-Id: I55416a19f4836cbed943adaa3f672538ea5d166d Reviewed-on: https://go-review.googlesource.com/21429 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Joe Tsai <joetsai@digital-static.net> TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-10-14compress/gzip: fix go vet warningJoe Tsai
Change-Id: I2ac6b178e666e34e028001078faf62ce71e12e9d Reviewed-on: https://go-review.googlesource.com/15834 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-23compress/gzip: detect truncated streamsJoe Tsai
Reader fails to detect truncated streams since calls to io.ReadFull do not check if the error is io.EOF. Change-Id: I052cd03161e43fec17e3d328106c40e17923e52b Reviewed-on: https://go-review.googlesource.com/14832 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2014-10-20compress/gzip: allow stopping at end of first streamRuss Cox
Allows parsing some file formats that assign special meaning to which stream data is found in. Will do the same for compress/bzip2 once this is reviewed and submitted. Fixes #6486. LGTM=nigeltao R=nigeltao, dan.kortschak CC=adg, bradfitz, golang-codereviews, r https://golang.org/cl/159120044
2014-09-08build: move package sources from src/pkg to srcRuss Cox
Preparation was in CL 134570043. This CL contains only the effect of 'hg mv src/pkg/* src'. For more about the move, see golang.org/s/go14nopkg.