golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
123.46k stars 17.59k forks source link

flate stream compress/decompress bug #8304

Closed gopherbot closed 9 years ago

gopherbot commented 10 years ago

by pepe.aracil.gomez:

Detected in Go 1.3.

compress/flate module in streaming mode (using Flush()) fails when the stream reach max
history size (32k).

code example:
http://play.golang.org/p/AZRbUXZ7VX

Note:
If the blocks size are power of 2 (1024 for example), it works ok.

Thanks

Attachments:

  1. flatebug.go (1002 bytes)
ianlancetaylor commented 10 years ago

Comment 1:

The Read function makes no promise that it will fill the entire buffer.  For the
promises made by a standard Read method, see http://golang.org/pkg/io/#Reader .
You can fix your program by using io.ReadFull, as in http://play.golang.org/p/wwProGUozh
.

Status changed to WorkingAsIntended.

gopherbot commented 10 years ago

Comment 2 by pepe.aracil.gomez:

Thanks for clarifying.