Skip to content

Commit 274eec7

Browse files
committed
Fix negative ranges memory budget
1 parent 4762edf commit 274eec7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

vm/vm.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,9 @@ func (vm *VM) Run(program *Program, env any) (_ any, err error) {
269269
min := runtime.ToInt(a)
270270
max := runtime.ToInt(b)
271271
size := max - min + 1
272+
if size <= 0 {
273+
size = 0
274+
}
272275
vm.memGrow(uint(size))
273276
vm.push(runtime.MakeRange(min, max))
274277

0 commit comments

Comments
 (0)