forked from TrueCloudLab/frostfs-node
[#1007] metabase: Copy BoltDB value returned by IsSmall
According to BoltDB documentation bucket `value is only valid for the life of the transaction`. Make `DB.IsSmall` copy value slice in order to prevent potential memory corruptions (e.g. `runtime.stringtobyteslice` cast). Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
c383fc6929
commit
f9bcb6f5e3
1 changed files with 2 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
|||
package meta
|
||||
|
||||
import (
|
||||
"github.com/nspcc-dev/neo-go/pkg/util/slice"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobovnicza"
|
||||
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object"
|
||||
"go.etcd.io/bbolt"
|
||||
|
@ -69,5 +70,5 @@ func (db *DB) isSmall(tx *bbolt.Tx, addr *objectSDK.Address) (*blobovnicza.ID, e
|
|||
return nil, nil
|
||||
}
|
||||
|
||||
return blobovnicza.NewIDFromBytes(blobovniczaID), nil
|
||||
return blobovnicza.NewIDFromBytes(slice.Copy(blobovniczaID)), nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue