4 ms·
The vast, vast majority of buffer overruns, memory leaks and race conditions live in Javascript code. (An interpreted, garbage-collected language.) You don't u
by otabdeveloper4 5y ago
The vast, vast majority of buffer overruns, memory leaks and race conditions live in Javascript code. (An interpreted, garbage-collected language.)
You don't understand what the memory safety promised by Rust actually does.
(No, it won't save you from buffer overruns. Only from segfaults.)
- nine_k 5y agoNo, you can't get an RCE with an index being out of bounds in JS. You get a safe `undefined`, and a denial of service at best. With a buffer overrun in C, you can smash the stack or other interesting structures, and put executable code of your choice in it. If you have the right kind if container breach and privilege escalation exploit lying around for the target OS, you can pwn the entire infrastructure eventually. And no, I don't think you can memcpy / strcpy data[*i++] with abandon in Rust without first marking such code unsafe. To say nothing of concurrent modification which is another popular source of index overruns, and more.
- otabdeveloper4 5y ago'undefined' is never safe in Javascript. As for the rest of your comment - good job on completely missing the point. When we talk about "buffer overflows", privilige escalation exploits are the least of our problems. https://hackernoon.com/null-the-billion-dollar-mistake-8t5z32d6 https://hackernoon.com/null-the-billion-dollar-mistake-8t5z3...
- pritambarhate 5y agoThe link you gave doesn't even mention buffer overflows. Do you have some material which explains the things you are trying to claim in more detail?
- paavohtl 5y agoOf course undefined is safe. It is just a different kind of null, and nothing else.
- otabdeveloper4 5y agoYou're redefining "safe" to mean "doesn't segfault". Telling your boss that the frontend is splattered with 'undefined' and all the balances are unsynchronized, but, hey, it's not a bug because no segfaults were involved in the process is a very good way to get fired.
- paavohtl 5y agoIf you are using TypeScript (which you should), undefined is not inherently any more dangerous or unpredictable than any other form of encoding missing values.
- otabdeveloper4 5y agoTypeScript is better than JavaScript, yes. But still it doesn't guarantee anything at runtime.
- kaba0 5y agoCan you modify a value in another part of your code through undefined?
- aidenn0 5y agoA language that always segfaults on buffer overruns is memory safe.