4 ms·
> null pointer dereference: relies on hardware protection > integer overflow: wrap-around semantics Interesting choice of words to not say "none".
by sedatk 6y ago
> null pointer dereference: relies on hardware protection
> integer overflow: wrap-around semantics
Interesting choice of words to not say "none".
- WalterBright 6y agoHardware seg faults for accessing the first page in memory are the norm for modern machines. Back in the 16 bit real mode DOS days, writing to the first K of memory would trash the interrupt vector table. But that was a 1980 design.
- pjmlp 6y agoThat doesn't work in WebAssembly, so you will get exactly the same corruption as in MS-DOS days.
- WalterBright 6y agoI don't know anything about WebAssembly, but that sounds like a major design flaw in it.
- pjmlp 6y agoWebAssembly has several flaws, one of them is lack of bounds checking for memory access inside of the same linear segment, so while it is sandboxed it cannot prevent that the data turns into garbage, and thus be open to attacks that change the outcome of public APIs based on internal memory state. But hey, it sells better than Flash or PNaCL.
- sedatk 6y agoYes, but when you put it like that, it feels like D makes use of a certain hardware protection unlike other languages. The article states "none" for those cases.
- mhh__ 6y agoInteger overflow is defined behaviour however, so we can provide library types which are checked. And since D's templates are very clean to define they are easy to use. The null pointer thing is true however all the other mechanisms mentioned do help eliminate bumping into them, and there will be more on the way. If you want to provide the null checks yourself D has Ada-style contract programming too.
- WalterBright 6y agoD also has a full set of a checked integer type: https://dlang.org/phobos/std_experimental_checkedint.html https://dlang.org/phobos/std_experimental_checkedint.html