• Joe Tsai's avatar
    compress/gzip: fix Reader to properly check FHCRC · d0e8d3a7
    Joe Tsai authored
    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/21466Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
    Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    d0e8d3a7
gunzip_test.go 16.9 KB