Skip to content

Commit

Permalink
CompressingReader: account for possible out buffer state
Browse files Browse the repository at this point in the history
It is possible for out buffer to have no overflow data and yet
the read offset will be not zero (if byte slices passed by the reader
just happened to align perfectly).

Signed-off-by: Alex Dubov <oakad@yahoo.com>
  • Loading branch information
oakad committed Nov 13, 2023
1 parent f2ece5b commit 4a80a2f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions compressing_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,11 @@ func (wr *ovWriter) reset(out []byte) bool {
wr.dataPos = ovRem
}

if wr.ovPos > 0 {
wr.ov = wr.ov[ : 0]
wr.ovPos = 0
}

wr.data = out
return true
}
Expand Down

0 comments on commit 4a80a2f

Please sign in to comment.