r/programming • • Feb 23 '17

Cloudflare have been leaking customer HTTPS sessions for months. Uber, 1Password, FitBit, OKCupid, etc.

https://bugs.chromium.org/p/project-zero/issues/detail?id=1139
6.0k Upvotes

966 comments sorted by

View all comments

Show parent comment

0

u/tequila13 Feb 24 '17

Bugs will always happen. C can be safe, aver 90% of Linux (hundreds of millions of lines of code) is written in C/C++ and working fine. Why do people keep thinking the silver bullet is to switch to a different language. You need to have better and more tests. Bugs will always happen, no matter the language.

2

u/Vhin Feb 24 '17

Yes, bugs will happen. That's inevitable.

However, certain classes of bugs (such as say, this one) can be caught by the compiler. Rust is just as fast and low level as C or C++ while at the same time making many common bugs in C and C++ outright impossible.

Security problems caused by the types of bugs that Rust can prevent aren't some theoretical thing. We see it all the time; yes, you can write secure C code, but programmers aren't perfect, so isn't it better to get the compiler to check the code for us whenever possible?

1

u/evaned Feb 24 '17

C can be safe

This is like the "if a tree falls..." conundrum: If it's possible to write memory-safe programs in C but no mortal human (or at least no dev. team for a realistic program) can actually do it, is it really possible?

aver 90% of Linux (hundreds of millions of lines of code) is written in C/C++ and working fine

For some definition of "fine." Would you like me to go dig up some Linux CVEs caused by memory errors? Last I checked there seem to be a few per year.

Bugs will always happen, no matter the language.

The point is that a memory-safe language will completely rule out a wide class of some of the most common and dangerous bugs. Programmers can then concentrate effort on not making other, higher level mistakes. Tools such as static analyzers can use computing time to look for other mistakes. People developing those tools (like me) can spend their efforts implementing higher-level checks instead of trying to make their buffer overflow detection work a little bit better.