From 56e5d7a457810aa68fb264e87aa3f24f13a1ef84 Mon Sep 17 00:00:00 2001 From: Masaaki Goshima Date: Sat, 12 Jun 2021 22:02:03 +0900 Subject: [PATCH] Fix index number about length for recursive type --- internal/encoder/compiler.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/encoder/compiler.go b/internal/encoder/compiler.go index 56a9604..30c927b 100644 --- a/internal/encoder/compiler.go +++ b/internal/encoder/compiler.go @@ -269,8 +269,8 @@ func linkRecursiveCode(c *Opcode) { lastCode.Length = lastCode.Idx + 2*uintptrSize // extend length to alloc slot for elemIdx + length - totalLength := uintptr(code.TotalLength() + 2) - nextTotalLength := uintptr(c.TotalLength() + 2) + totalLength := uintptr(code.TotalLength() + 3) + nextTotalLength := uintptr(c.TotalLength() + 3) c.End.Next.Op = OpRecursiveEnd