diff --git a/pkg/vm/vm.go b/pkg/vm/vm.go index a3c14149d..c9bc97d2b 100644 --- a/pkg/vm/vm.go +++ b/pkg/vm/vm.go @@ -641,9 +641,6 @@ func (v *VM) execute(ctx *Context, op Instruction) { arr := t.Value().([]StackItem) arr = append(arr, itemElem.value) t.value = arr - case *ByteArrayItem: - newVal := append(t.value, itemElem.value.Value().([]byte)...) - v.estack.PushVal(newVal) default: panic("APPEND: not of underlying type Array") } diff --git a/pkg/vm/vm_test.go b/pkg/vm/vm_test.go index 1a7b466b4..5a7f5771a 100644 --- a/pkg/vm/vm_test.go +++ b/pkg/vm/vm_test.go @@ -479,6 +479,15 @@ func TestAPPENDBad1Argument(t *testing.T) { assert.Equal(t, true, vm.state.HasFlag(faultState)) } +func TestAPPENDWrongType(t *testing.T) { + prog := makeProgram(APPEND) + vm := load(prog) + vm.estack.PushVal([]byte{}) + vm.estack.PushVal(1) + vm.Run() + assert.Equal(t, true, vm.state.HasFlag(faultState)) +} + func TestSIGNNoArgument(t *testing.T) { prog := makeProgram(SIGN) vm := load(prog)