From 90d3bcbdc36e3be36c6c2cad23b366a73934c379 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Thu, 18 Jun 2020 21:59:58 +0300 Subject: [PATCH] state: initialize PublicKey before decoding into it, fix #1061 These are pointers and decoding into a nil pointer is a bad idea. --- pkg/core/state/native_state.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/core/state/native_state.go b/pkg/core/state/native_state.go index d551c6711..bb1d94ebf 100644 --- a/pkg/core/state/native_state.go +++ b/pkg/core/state/native_state.go @@ -125,6 +125,7 @@ func (s *NEOBalanceState) fromStackItem(item stackitem.Item) { votes := structItem[2].Value().([]stackitem.Item) s.Votes = make([]*keys.PublicKey, len(votes)) for i, v := range votes { + s.Votes[i] = new(keys.PublicKey) s.Votes[i].DecodeBytes(v.Value().([]byte)) } }