]> Cypherpunks repositories - gostls13.git/commit
compress/gzip: fix Reader to properly check FHCRC
authorJoe Tsai <joetsai@digital-static.net>
Sat, 2 Apr 2016 23:47:51 +0000 (16:47 -0700)
committerIan Lance Taylor <iant@golang.org>
Thu, 14 Apr 2016 23:45:51 +0000 (23:45 +0000)
commitd0e8d3a7ae2194b1753bc4e419d5f00aa2d5cb86
treeee5fc57cefc9a3e44cd7cb84229842921f74c036
parentd093a6269160cf94b7add76dc3e60e94d8afc44e
compress/gzip: fix Reader to properly check FHCRC

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>
src/compress/gzip/gunzip.go
src/compress/gzip/gunzip_test.go
src/compress/gzip/gzip.go