Skip to content

Commit

Permalink
Comments.
Browse files Browse the repository at this point in the history
Signed-off-by: Nuno Cruces <[email protected]>
  • Loading branch information
ncruces committed Sep 16, 2024
1 parent 20de8b0 commit 9e11783
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions internal/wasm/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,14 +239,13 @@ func (m *MemoryInstance) Grow(delta uint32) (result uint32, ok bool) {
return currentPages, true
}

// If exceeds the max of memory size, we push -1 according to the spec.
newPages := currentPages + delta
if newPages > m.Max || int32(delta) < 0 {
return 0, false
} else if m.expBuffer != nil {
buffer := m.expBuffer.Reallocate(MemoryPagesToBytesNum(newPages))
// If the allocator fails to grow, we push -1 according to the spec.
if buffer == nil {
// Allocator failed to grow.
return 0, false
}
if m.Shared {
Expand Down

0 comments on commit 9e11783

Please sign in to comment.