Skip to content
This repository was archived by the owner on May 11, 2020. It is now read-only.

Commit 2c7e398

Browse files
vibhavpsbinet
authored andcommitted
exec: ExecCode: Don't reuse the stack.
This ensures the stack length always starts with 0.
1 parent 059d335 commit 2c7e398

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

exec/vm.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,8 @@ func (vm *VM) ExecCode(fnIndex int64, args ...uint64) (interface{}, error) {
246246
return nil, ErrInvalidArgumentCount
247247
}
248248
compiled := vm.compiledFuncs[fnIndex]
249-
if len(vm.ctx.stack) < compiled.maxDepth {
250-
vm.ctx.stack = make([]uint64, 0, compiled.maxDepth)
251-
}
249+
250+
vm.ctx.stack = make([]uint64, 0, compiled.maxDepth)
252251
vm.ctx.locals = make([]uint64, compiled.totalLocalVars)
253252
vm.ctx.pc = 0
254253
vm.ctx.code = compiled.code

0 commit comments

Comments
 (0)