fastlike
fastlike copied to clipboard
Ensure ABI functions properly cast ints
So, wasm has int32 and int64 and makes no decision as to signed or unsigned, that part is left up to the compiler/runtime. wasmtime chose to use unsigned, which means all of the import funcs (functions defined in Go that are made available to the wasm program) have signatures that take a number of uint32 and uint64 args and return a uint32.
But, some of those uints should be cast to signed and there may be one or more bugs hiding in there as a result.
I'll need to go over each ABI method signature again in fastly-sys and ensure the types we use in fastlike match the types used on the fastly side to prevent an under/overflow.
For instance, "handle" types (request, response, body) are all uint32 which means we're safe, but functions like xqd_body_write which expect the embedder to write the number of bytes written to a pointer in linear memory expect the numbers of bytes written to be usize