]> Cypherpunks repositories - gostls13.git/commit
mime/multipart: don't call Read on io.Reader after an error is seen
authorBrad Fitzpatrick <bradfitz@golang.org>
Mon, 7 Mar 2016 16:35:45 +0000 (08:35 -0800)
committerAndrew Gerrand <adg@golang.org>
Thu, 14 Apr 2016 05:24:05 +0000 (05:24 +0000)
commit16f783ee7c1cd2dc999525e7b35360fc0112590a
tree5246f5d5e4aa220205077e52617c30e3beb65f5c
parent7d5b0e2560fa6796c911f3ffdd465ecb5b3d55da
mime/multipart: don't call Read on io.Reader after an error is seen

The io.Reader contract makes no promises about how a Reader should
behave after it returns its first error. Usually the errors are
sticky, but they don't have to be. A regression in zlib.Reader (bug
accidentally relied on sticky errors.

Minimal fix: wrap the user's provided Reader in a Reader which
guarantees stickiness. The minimal fix is less scary than touching
the multipart state machine.

Fixes #14676

Change-Id: I8dd8814b13ae5530824ae0e68529f788974264a5
Reviewed-on: https://go-review.googlesource.com/20297
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-on: https://go-review.googlesource.com/22045
src/mime/multipart/formdata_test.go
src/mime/multipart/multipart.go