Confession of a C/C++ programmer

I've been programming in C and C++ for over 25 years. I have a PhD in Computer Science from a top-ranked program, and I was a Distinguished Engineer at Mozilla where for over ten years my main job was developing and reviewing C++ code. I cannot consistently write safe C/C++ code. I'm not ashamed of that; I don't know anyone else who can. I've heard maybe Daniel J. Bernstein can, but I'm convinced that, even at the elite level, such people are few and far between.

I see a lot of people assert that safety issues (leading to exploitable bugs) with C and C++ only afflict "incompetent" or "mediocre" programmers, and one need only hire "skilled" programmers (such as, presumably, the asserters) and the problems go away. I suspect such assertions are examples of the Dunning-Kruger effect, since I have never heard them made by someone I know to be a highly skilled programmer.

I imagine that many developers successfully create C/C++ programs that work for a given task, and no-one ever fuzzes or otherwise tries to find exploitable bugs in those programs, so those developers naturally assume their programs are robust and free of exploitable bugs, creating false optimism about their own abilities. Maybe it would be useful to have an online coding exercise where you are given some apparently-simple task, you write a C/C++ program to solve it, and then your solution is rigorously fuzzed for exploitable bugs. If any such bugs are found then you are demoted to the rank of "incompetent C/C++ programmer".

Attached: 7A06909A-AF2A-45A8-988E-35DF040FCADC.jpg (1536x2048, 388K)

Other urls found in this thread:

yodaiken.com/2018/06/07/torvalds-on-aliasing/
twitter.com/SFWRedditVideos

yeah no you're not

Security bugs are usually a product of complexity; it's trivial to write a "safe" FizzBuzz, writing a "safe" encryption library on the other hand, is non-trivial.

Consider the fact that TLS is implemented in C.

Just the other day I saw a commit on sway that replaced something like this:
calloc(1, n * sizeof(var));
Seriously, there is no shortage of imbeciles in CS

One thing is faults like buffer overflows, the other is programmatic errors (such as the duplicated goto error line that caused heartbleed).

OH GODDD OH FUCCK OH OH OHHHH IMMM COMMINNNGG AAHHHHHHHHH

AAAAAAAAHHHHHHHHHHH I'M GOING TO FUCKING COOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOM

> Nice copypasta
> Poor bait though

What's wrong with it? Except for the parenthesis around var