Skip to content

Commit

Permalink
vm: improve stack size related errors
Browse files Browse the repository at this point in the history
No functional changes, just add more details to the error.

Signed-off-by: Anna Shaleva <[email protected]>
  • Loading branch information
AnnaShaleva committed Jun 11, 2024
1 parent effba1f commit d156cea
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/vm/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
}()

Expand Down Expand Up @@ -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)))
}
}

Expand Down

0 comments on commit d156cea

Please sign in to comment.