compress/zlib: zlib.NewReader
with (yet) empty buffer causes unexpected EOF
even before calling Read
#58992
Labels
zlib.NewReader
with (yet) empty buffer causes unexpected EOF
even before calling Read
#58992
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Initiated a new zlib Reader with a (yet) empty buffer as input (e.g. on new network connection). The buffer is later populated as data becomes available (e.g. reading from a network connection) and, after data has been written, the zlib reader is consumed.
https://go.dev/play/p/cgSFSQYy8bL
What did you expect to see?
No errors and the
Hello World!
message. The underlying buffer should only be consumed once the zlib Reader starts to be consumed.What did you see instead?
The
zlib.NewReader
call errors withunexpected EOF
as it tries to read data before the buffer is populated, a behavior which is not documented.The text was updated successfully, but these errors were encountered: