Skip to content

Commit

Permalink
Merge pull request #2613 from oasislabs/matevz/bug/mkvs-crash
Browse files Browse the repository at this point in the history
go/storage/mkvs/urkel: fix invalid memory access when unmarshalling
  • Loading branch information
matevz authored Jan 29, 2020
2 parents 9e89921 + 2f70937 commit 56e6d7f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions .changelog/2611.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
go/storage: Fix invalid memory access crash in Urkel tree
3 changes: 2 additions & 1 deletion go/storage/mkvs/urkel/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,8 @@ func (n *LeafNode) SizedUnmarshalBinary(data []byte) (int, error) {
valueSize := int(binary.LittleEndian.Uint32(data[pos : pos+ValueLengthSize]))
pos += ValueLengthSize

value := data[pos : pos+valueSize]
value := make([]byte, valueSize)
copy(value, data[pos:pos+valueSize])
pos += valueSize

n.Clean = true
Expand Down

0 comments on commit 56e6d7f

Please sign in to comment.