News for hackers. Stuff that matters.
Re:WebAssembly doesn’t make unsafe languages safe by azakai on Sunday November 25, 2018 @04:37PM (#18529211)
It's true that in theory a NULL pointer could be 0xffffffff or such, and that would prevent some of the problems the article mentions. However, that would only help when you assign NULL to a pointer explicitly. The problem is that in practice NULL pointers are often caused by other things, like thinking that zero-initialized memory contains a pointer - in fact, this is even more common in wasm than natively, since wasm guarantees memory and stack are initialized to zero.

This is serious enough an issue that for debugging purposes emscripten has a SAFE_HEAP mode which will check for NULL pointers on every access. We'd still need that to look for 0 even if the compiler considered NULL to be something other than 0.

Re:WebAssembly doesn’t make unsafe languages safe by int_19h on Sunday November 25, 2018 @07:41PM (#18530096)
> The problem is that in practice NULL pointers are often caused by other things, like thinking that zero-initialized memory contains a pointer

Which, to be clear, is not a valid assumption wrt portable C or C++.

Re:WebAssembly doesn’t make unsafe languages safe by spc476 on Monday November 26, 2018 @01:41AM (#18531577)
While C may not mandate zero-initialized pointer is NULL, POSIX does.