diff --git a/pkg/vm/vm.go b/pkg/vm/vm.go index aeb8b0180..9a022e75a 100644 --- a/pkg/vm/vm.go +++ b/pkg/vm/vm.go @@ -1029,12 +1029,7 @@ func (v *VM) execute(ctx *Context, op opcode.Opcode, parameter []byte) (err erro } v.estack.Push(&Element{value: t.value[index].Value.Dup()}) default: - arr := obj.Bytes() - if index < 0 || index >= len(arr) { - panic("PICKITEM: invalid index") - } - item := arr[index] - v.estack.PushVal(int(item)) + panic("PICKITEM: unknown type") } case opcode.SETITEM: diff --git a/pkg/vm/vm_test.go b/pkg/vm/vm_test.go index aab31a408..34c5ddab2 100644 --- a/pkg/vm/vm_test.go +++ b/pkg/vm/vm_test.go @@ -1367,9 +1367,7 @@ func TestPICKITEMByteArray(t *testing.T) { vm := load(prog) vm.estack.PushVal([]byte{1, 2}) vm.estack.PushVal(1) - runVM(t, vm) - assert.Equal(t, 1, vm.estack.Len()) - assert.Equal(t, makeStackItem(2), vm.estack.Pop().value) + checkVMFailed(t, vm) } func TestPICKITEMDupArray(t *testing.T) {