From d156cea24dbcc41a86f23b0e313f0d3a1f00957e Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Tue, 11 Jun 2024 18:34:22 +0300 Subject: [PATCH] vm: improve stack size related errors No functional changes, just add more details to the error. Signed-off-by: Anna Shaleva --- pkg/vm/vm.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/vm/vm.go b/pkg/vm/vm.go index d3959f1e2..2b94cbcb7 100644 --- a/pkg/vm/vm.go +++ b/pkg/vm/vm.go @@ -594,7 +594,7 @@ func (v *VM) execute(ctx *Context, op opcode.Opcode, parameter []byte) (err erro err = newError(ctx.ip, op, errRecover) } else if v.refs > MaxStackSize { v.state = vmstate.Fault - err = newError(ctx.ip, op, "stack is too big") + err = newError(ctx.ip, op, fmt.Sprintf("stack is too big: %d vs %d", int(v.refs), MaxStackSize)) } }() @@ -1995,7 +1995,7 @@ func validateMapKey(key Element) { func (v *VM) checkInvocationStackSize() { if len(v.istack) >= MaxInvocationStackSize { - panic("invocation stack is too big") + panic(fmt.Sprintf("invocation stack is too big: %d", len(v.istack))) } }