From 18447e66a7a0e4d39ee5b5bcb9e94df372e67bd9 Mon Sep 17 00:00:00 2001 From: Eric Coissac Date: Wed, 16 Nov 2022 09:24:17 +0100 Subject: [PATCH] Patch a critical bug into the CopySlice function. --- pkg/obiseq/pool.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/obiseq/pool.go b/pkg/obiseq/pool.go index 6bbcb09..dc67014 100644 --- a/pkg/obiseq/pool.go +++ b/pkg/obiseq/pool.go @@ -40,8 +40,10 @@ func GetSlice(capacity int) []byte { } func CopySlice(src []byte) []byte { - sl := GetSlice(len(src)) + sl := GetSlice(len(src))[0:len(src)] + copy(sl, src) + return sl } @@ -61,6 +63,7 @@ func RecycleAnnotation(a *Annotation) { } } +// It returns a new Annotation object, initialized with the values from the first argument func GetAnnotation(values ...Annotation) Annotation { a := Annotation(nil)