Beef icon indicating copy to clipboard operation
Beef copied to clipboard

Memory acess error when calling bound function on wasm

Open Booklordofthedings opened this issue 1 year ago • 1 comments

This was already known so its more to help if others have the same issue.

If you call a function via a function binding and pass in a struct that is pointer sized (32bits) it might throw a memory out of bounds error or just corrupt data.

This occurs because wasm expects every function to pass structs by reference taking in a 32bit pointer. However some component doesnt seem to realize that and tries to pass by value.

One fix would be to change the function definition on wasm to function(in struct structname). Or by taking the pointer to the struct and somehow casting that back to a struct.

Booklordofthedings avatar Jan 08 '24 13:01 Booklordofthedings

Yeah, wasm needs a full calling convention conformance pass. Wasm needs Test support. Wasm needs CI testing in Jenkins.

bfiete avatar Jan 08 '24 15:01 bfiete