From 7018dd7bdc10121c7654b051937fbf300900c257 Mon Sep 17 00:00:00 2001 From: tdakkota Date: Wed, 6 Apr 2022 06:09:41 +0300 Subject: [PATCH] fix: cut tmp slice length in decodeRuneInByteseq --- byteseq.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/byteseq.go b/byteseq.go index 93e2e15..231c358 100644 --- a/byteseq.go +++ b/byteseq.go @@ -8,6 +8,6 @@ type byteseq interface { func decodeRuneInByteseq[T byteseq](val T) (r rune, size int) { var tmp [4]byte - copy(tmp[:], val) - return utf8.DecodeRune(tmp[:]) + n := copy(tmp[:], val) + return utf8.DecodeRune(tmp[:n]) }