Closed
Description
I think this was introduced with #1682. That PR seems to indicate that null
strings should be handled as the empty string, but they can cause a memory access out of bounds
error.
export function prefix(s: string): string {
return "prefix:" + s;
}
<!DOCTYPE html>
<script>
async function main() {
const { instance } = await WebAssembly.instantiateStreaming(
fetch("lol.wasm"),
{
env: {
abort() {
throw Error("ARGH");
},
},
}
);
const strPtr = 0; // !! Invalid string pointer
instance.exports.prefix(strPtr);
}
main();
</script>