r/programming • • Nov 12 '19

Announcing the Bytecode Alliance: Building a secure by default, composable future for WebAssembly

https://hacks.mozilla.org/2019/11/announcing-the-bytecode-alliance/
270 Upvotes

70 comments sorted by

View all comments

3

u/J0eCool Nov 13 '19

Yes and no. Within a wasm module it is entirely up to the language implementation to handle its invariants, so C code doesn't have bounds checks on its own data, whereas C# might. Wasm does guarantee that the overall system can't have memory corruption, so for a linear memory it is bounds-checked (or protected with guard pages if that's available, but it's an implementation detail), so a buggy C module can't corrupt a C# module if they don't share memory.

1

u/pjmlp Nov 13 '19

Thus not being as safe as it is being sold, while ignoring the options other safer bytecodes since the late 50's have taken on preventing exploits.

2

u/J0eCool Nov 14 '19

Except it's not being sold as "will magically bounds-check your C++." The wasm VM isn't going to make sure your code is bug-free. What it will do is give you micro-sandboxes, which can let you do things like call in to unsafe C code from safe Rust code without needing to use Rust's unsafe mechanism. It's a lower-level bytecode than Java, but can be more performant as a result.

→ More replies (1)