3 ms·
> If I access memory I didn't allocate the OS shuts the program down. The real problem is when you access memory that did allocate.
by koolba 2y ago
> If I access memory I didn't allocate the OS shuts the program down.
The real problem is when you access memory that did allocate.
- dheera 2y agoSo we need a new flag for gcc that writes zeros to any block of allocated memory before malloc returns, not a new language.
- KMag 2y agoYou'd probably want an alternative libc implementation rather than a compiler flag. However, calloc everywhere won't save you from smashing the stack or pointer type confusion (a common source of JavaScript exploits). Very rarely is leftover data from freed memory the source of an exploit.
- kelnos 2y agoThat wouldn't make it safe. It would just make it crash in a different way, and still be vulnerable to exploitation by an attacker.
- saagarjha 2y agoWe have that already. There are still other problems that exist.
- BlobberSnobber 2y agoIf only the very competent people that decided to create Rust had thought of asking you for the solution instead... Have a little humility.