by stkdump · 3y ago · 0 comments
I am all for making C and C++ safer by adding mitigations for the most common security relevant bugs. Either on language level, or on tooling level or on OS level or on CPU level. Or a combination of them. But since making a language absolutely memory safe doesn't make it automatically impossible to have bugs at all (even security relevant bugs), we should consider everything a trade-off.
I _love_ C and I've written one C program every year for the last decade or two. I generally write something really stupid, but there's going to be crashes that "prints the stack pants." As in: I'll fudge up returning the stack from a function, basically.
This proves nothing, of course. But Rust won't even let me fudge things up that way. This means that I have more time to spend fixing those other classes of bugs and that is the win!
For instance I find it incredible that you never had to debug and workaround a third party vendor DLL that you didn't have source for but that was leaking memory like crazy. This is the just one example of something that can be "fixed trivially" as you don't have source to modify, and is extremely common in some fields (i.e. embedded)
And no, we didn't have major issues with memory leaks either. About on par with what I have seen in garbage collected languages. RAII works quite good most of the time.
Then people could decide which ones to use based on the label alone. This would be an incentive for people to fix their libraries.
Then the process of normal attrition would take care of all the sloppy libraries.
Evolution at its finest.
Had UNIX not been free beer, history would have been quite different for C and C++.
This is a singularly bad analogy. HIV used to be a death sentence, but now we have effective treatments and prophylactics.
What's the PrEP equivalent for buffer overflows? There isn't one.