Skip to content

Commit

Permalink
fix(stdlib): Remove memory corruption in File.fdReaddir (#1573)
Browse files Browse the repository at this point in the history
Co-authored-by: av8ta <[email protected]>
Co-authored-by: Oscar Spencer <[email protected]>
  • Loading branch information
3 people committed Jan 5, 2023
1 parent 925b51d commit 060fc7b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions stdlib/sys/file.gr
Original file line number Diff line number Diff line change
Expand Up @@ -1128,9 +1128,9 @@ export let fdReaddir = (fd: FileDescriptor) => {

let filetype = filetypeFromNumber(WasmI32.load8U(ent, 20n))

let dirent = { inode, path, filetype }
let dirent = WasmI32.fromGrain({ inode, path, filetype })

WasmI32.store(arr + i * 4n, WasmI32.fromGrain(dirent), 8n)
WasmI32.store(arr + i * 4n, Memory.incRef(dirent), 8n)

let next = WasmI32.load(bufs, 4n)
Memory.free(bufs)
Expand Down

0 comments on commit 060fc7b

Please sign in to comment.