Brad Fitzpatrick 62685c2d7c http2: fix crash in Transport on double Read of invalid gzip Response.Body
This old code was buggy:

type gzipReader struct {
        body io.ReadCloser // underlying Response.Body
        zr   io.Reader     // lazily-initialized gzip reader
}

func (gz *gzipReader) Read(p []byte) (n int, err error) {
        if gz.zr == nil {
                gz.zr, err = gzip.NewReader(gz.body)
                if err != nil {
                        return 0, err
                }
        }
        return gz.zr.Read(p)
}

If a Read on a gzipped Response.Body (of type *http2.gzipReader)
resulted in gzip.NewReader returning an error, gzipReader assigned
a *gzip.Reader-typed nil value to the gz.zr interface value.

On a subsequent Read, gz.zr would not be equal to ==, because it was
actually equal to (type *gzip.Reader, nil), and then zr.Read would call
(*gzip.Reader).Read with a nil receiver and explode.

Debugged internally. (http://go/http2gzipbug)

Change-Id: Icba040ace8ffac3536e5e7ade6695c7660838ca1
2016-02-13 02:03:29 +00:00
2014-12-09 14:17:11 +11:00
2016-01-08 17:00:32 +00:00
2016-01-15 04:49:47 +00:00
2014-12-09 14:17:11 +11:00
2015-12-14 00:45:27 +00:00
2014-12-09 14:17:11 +11:00
2015-12-11 09:22:36 +00:00
2014-12-08 10:44:07 +11:00
2015-03-18 17:04:12 +00:00
2015-02-18 23:42:41 +00:00
2012-03-17 15:20:00 +11:00
2012-01-25 15:31:30 -05:00

This repository holds supplementary Go networking libraries.

To submit changes to this repository, see http://golang.org/doc/contribute.html.
Description
[mirror] Go supplementary network libraries
Readme BSD-3-Clause 13 MiB
Languages
Go 99.9%