So, given this is a fact, the best course of action is chosen the most safe alternative.
And for everyone else? Well an array of bits ant let the host/callers that are the only that know their own stuff deal with it.
INCLUDING Js.
string ≡ (list char)
char is defined to be a Unicode scalar value (i.e., a non-surrogate code point).Basically, this is "the most safe alternative"??!
A safe one. Your sample is that - except I think is better if is a utf-8 string, but this one works for me too-. What will be worrisome is if is made to be like in C.
Rust (or C++) strings are not pascal strings. In pascal strings, the "string buffer" also contains the length information, and historically it was all bytes with a length byte at the start, which was why your strings started at index 1 and limited to 254 bytes.
It's possible to modernise this style of strings to be less crummy (that is essentially what sds does), but C++/Rust string are a third take where the length (and capacity) are stored separately from the string buffer, and that buffer is always on the other side of a pointer (ignoring SSO, which Rust sadly doesn't have due to the original interface definition).
So you get all the fun to corrupt linear memory C style.
Agreed, but as consumer from WASM modules that isn't your option to make.
> WASM's job is to prevent code inside the sandbox from escaping the sandbox, not to prevent memory corruption inside the sandbox.
That is not better than a typical OS process, just it happens to be randomly downloaded into my computer.
On the other hand I need to admit that I would have not forseen some of the more recent use cases for WebAssembly
https://bytecodealliance.org/articles/making-javascript-run-...
which can be reminescent of the "docker daemon running as root" issue.
The good one!
UTf-8, NOT null terminated, pascal like.
ie: what rust have:
https://doc.rust-lang.org/std/string/struct.String.html
REPEAT the mistakes of C (and considering the security angle! in a browser!) must be a big no.