From 8f5f6fba079ae316ec9a2fd1b4a955f6a4467828 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 20 May 2020 12:02:06 +0300 Subject: [PATCH] vm: copy slice in (*ByteArrayItem).TryBytes() --- pkg/vm/stack_item.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/vm/stack_item.go b/pkg/vm/stack_item.go index 675105f6f..83baa2460 100644 --- a/pkg/vm/stack_item.go +++ b/pkg/vm/stack_item.go @@ -517,7 +517,9 @@ func (i *ByteArrayItem) Bool() bool { // TryBytes implements StackItem interface. func (i *ByteArrayItem) TryBytes() ([]byte, error) { - return i.value, nil + val := make([]byte, len(i.value)) + copy(val, i.value) + return val, nil } // TryInteger implements StackItem interface.