Restrict global and function references to memory size

This commit is contained in:
Ian Gulliver
2021-11-20 18:12:17 -10:00
parent bdb6b17187
commit bd84a5b969
6 changed files with 35 additions and 11 deletions

View File

@@ -12,10 +12,10 @@ func randOperand(t vm.OperandNumericType) *vm.Operand {
switch op.Type {
case vm.GlobalMemoryIndex:
op.Value = RandBiasedUint64()
op.Value = RandBiasedUint64n(vm.GlobalMemorySize)
case vm.FunctionMemoryIndex:
op.Value = RandBiasedUint64()
op.Value = RandBiasedUint64n(vm.FunctionMemorySize)
case vm.Literal:
switch t {