Skip to content

Commit

Permalink
Never return negative values from Write, as they can panic in `bufi…
Browse files Browse the repository at this point in the history
…o` (#33)

* Never return negative values from `Write`, as they can panic in `bufio`
  • Loading branch information
ajm188 committed May 15, 2020
1 parent 3fc4d32 commit 82f3a65
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gzip.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ func (z *Writer) Write(p []byte) (int, error) {
if len(z.currentBuffer) == z.blockSize {
z.compressCurrent(false)
if err := z.checkError(); err != nil {
return len(p) - len(q) - length, err
return len(p) - len(q), err
}
}
z.size += length
Expand Down

0 comments on commit 82f3a65

Please sign in to comment.