From 5989a82beee2f78f1d8bfefb442b84ec433f3801 Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Fri, 4 Jul 2025 14:18:30 -0400 Subject: [PATCH] tape: Fix negative slice length --- tape/dynamic.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tape/dynamic.go b/tape/dynamic.go index 2528ace..bded11f 100644 --- a/tape/dynamic.go +++ b/tape/dynamic.go @@ -129,7 +129,7 @@ func decodeAny(decoder *Decoder, destination reflect.Value, tag Tag) (n int, err return n, errWrongDestinationType("slice") } if destination.Cap() < int(length) { - destination.Grow(destination.Cap() - int(length)) + destination.Grow(int(length) - destination.Cap()) } destination.SetLen(int(length)) for index := range length {