Avoid panic in BytesTo func

This commit is contained in:
RPRX 2021-01-27 01:09:58 +00:00 committed by GitHub
parent ceff4185dc
commit c880b916ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -110,6 +110,9 @@ func (b *Buffer) BytesTo(to int32) []byte {
if to < 0 {
to += b.Len()
}
if to < 0 {
to = 0
}
return b.v[b.start : b.start+to]
}