]> Cypherpunks.ru repositories - gostls13.git/commit
compress/gzip: return unexpected EOF for certain truncated streams
authorPhil Bracikowski <pbracikowski@influxdata.com>
Wed, 2 Mar 2022 01:51:28 +0000 (01:51 +0000)
committerJoseph Tsai <joetsai@digital-static.net>
Wed, 2 Mar 2022 17:03:04 +0000 (17:03 +0000)
commit4a13f6f42ded127dc0d097f7d1f89916cbd9e729
treedcc93b362e88859cae1dfdef56d0876a84b2040e
parentf79a983891123f57dd7d37d09a51a287ac6d4cad
compress/gzip: return unexpected EOF for certain truncated streams

For cases where RFC 1952 requires a field, the code returns the error
io.ErrUnexpectedEOF except in two places: for the FNAME flag or the
FCOMMENT flag. These flags expect a null-terminated string and
readString may return an EOF if the Reader is truncated before a
null byte is found. For consistency with parsing other parts of the
header, this is converted to an unexpected EOF herein.

Follow-up to CL 14832.

Fixes #51417

Change-Id: I173283a6ae309e4a8e52fc15df404ce5db06eff1
GitHub-Last-Rev: 2e573cd961c0b1e4296fbde53097cf5723a2ca29
GitHub-Pull-Request: golang/go#51418
Reviewed-on: https://go-review.googlesource.com/c/go/+/389034
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Trust: Joseph Tsai <joetsai@digital-static.net>
Trust: Ian Lance Taylor <iant@golang.org>
src/compress/gzip/gunzip.go
src/compress/gzip/gunzip_test.go