Skip to content

Commit 4a80a2f

Browse files
committed
CompressingReader: account for possible out buffer state
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 <[email protected]>
1 parent f2ece5b commit 4a80a2f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

compressing_reader.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,11 @@ func (wr *ovWriter) reset(out []byte) bool {
206206
wr.dataPos = ovRem
207207
}
208208

209+
if wr.ovPos > 0 {
210+
wr.ov = wr.ov[ : 0]
211+
wr.ovPos = 0
212+
}
213+
209214
wr.data = out
210215
return true
211216
}

0 commit comments

Comments
 (0)