Skip to content

Commit

Permalink
Fix.
Browse files Browse the repository at this point in the history
Signed-off-by: Nuno Cruces <[email protected]>
  • Loading branch information
ncruces committed Feb 27, 2024
1 parent 46f8c86 commit cfdc9ff
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions internal/integration_test/vs/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ func (m *wazeroModule) Memory() []byte {
}

func (r *wazeroRuntime) log(_ context.Context, mod api.Module, stack []uint64) {
offset, byteCount := uint32(stack[0]), stack[1]
offset, byteCount := uint32(stack[0]), uint32(stack[1])

buf, ok := mod.Memory().Read(offset, byteCount)
buf, ok := mod.Memory().Read(offset, uint64(byteCount))
if !ok {
panic("out of memory reading log buffer")
}
Expand Down
4 changes: 2 additions & 2 deletions internal/logging/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@ func writeMemH64(_ context.Context, mod api.Module, w Writer, i uint32, vals []u
}

func writeString(_ context.Context, mod api.Module, w Writer, i uint32, vals []uint64) {
offset, byteCount := uint32(vals[i]), vals[i+1]
WriteStringOrOOM(mod.Memory(), w, offset, byteCount)
offset, byteCount := uint32(vals[i]), uint32(vals[i+1])
WriteStringOrOOM(mod.Memory(), w, offset, uint64(byteCount))
}

func WriteStringOrOOM(mem api.Memory, w Writer, offset uint32, byteCount uint64) {
Expand Down
4 changes: 2 additions & 2 deletions internal/wasip1/logging/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,8 @@ func (i logFdstat) Log(_ context.Context, mod api.Module, w logging.Writer, para
type logString uint32

func (i logString) Log(_ context.Context, mod api.Module, w logging.Writer, params []uint64) {
offset, byteCount := uint32(params[i]), uint64(params[i+1])
if s, ok := mod.Memory().Read(offset, byteCount); ok {
offset, byteCount := uint32(params[i]), uint32(params[i+1])
if s, ok := mod.Memory().Read(offset, uint64(byteCount)); ok {
w.Write(s) //nolint
}
}
Expand Down

0 comments on commit cfdc9ff

Please sign in to comment.