We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 41124a6 commit ea02415Copy full SHA for ea02415
internal/snapref/encode.go
@@ -20,8 +20,10 @@ import (
20
func Encode(dst, src []byte) []byte {
21
if n := MaxEncodedLen(len(src)); n < 0 {
22
panic(ErrTooLarge)
23
- } else if len(dst) < n {
+ } else if cap(dst) < n {
24
dst = make([]byte, n)
25
+ } else {
26
+ dst = dst[:n]
27
}
28
29
// The block starts with the varint-encoded length of the decompressed bytes.
0 commit comments