News for hackers. Stuff that matters.
Re:A Guide to Undefined Behavior in C and C++ (2010) by kstenerud on Sunday November 04, 2018 @01:28AM (#18374578)
My point is that it is humanly impossible to write a bug-free program. In C and C++, bugs usually manifest themselves in UB.

To make matters worse, compilers, ever searching for diminishing returns on performance improvements, have been steadily making the CONSEQUENCES of UB worse, to the point that even debugging is getting harder and harder. These languages are unique in their growing user hostility.

Re:A Guide to Undefined Behavior in C and C++ (2010) by llukas on Sunday November 04, 2018 @02:02AM (#18374648)
> growing user hostility

You have excellent tooling (*sanitizer, static analysis, valgrind, ${WHATEVER}) and abstractions provided to do handholding for you (ie. unique_ptr).

Most of that was created in last few years.

Re:A Guide to Undefined Behavior in C and C++ (2010) by pjmlp on Sunday November 04, 2018 @04:25AM (#18375025)
Completely wrong.

Lint was created in 1979, during the mid-90's we already had Insure++, Purify and others, ages before of the free beer alternatives.

Yet being free still doesn't help the large majority of C and C++ to actually use them, as proven at one of CppCon talks, where a tiny 1% of the attendees confirmed using any kind of analysers.

Re:A Guide to Undefined Behavior in C and C++ (2010) by gpderetta on Sunday November 04, 2018 @09:24AM (#18375981)
Lint is not a whole program static analyzer and being free is a big deal.

Your -second- third paragraph is, unfortunately, still correct though.

Re:A Guide to Undefined Behavior in C and C++ (2010) by pjmlp on Sunday November 04, 2018 @10:14AM (#18376192)
Somehow other professionals manage to pay for what goes into their toolboxes, music case, kitchen knives, ....
Re:A Guide to Undefined Behavior in C and C++ (2010) by minipci1321 on Sunday November 04, 2018 @06:41AM (#18375392)
How well the attendees of CppCon represent the developer base of C++ projects which are in dire needs of these tools?

Maybe they are so skilled the need does not arise?

Re:A Guide to Undefined Behavior in C and C++ (2010) by jcranmer on Sunday November 04, 2018 @08:38AM (#18375791)
One of the most eye-opening papers in this regard was the integer overflow checking paper (which Regehr was coauthor on), which found that every library tested invoked undefined signed integer overflow. This includes SQLite, infamous for its comprehensive testing, and various libraries whose sole purpose was to check if an operation would overflow without invoking undefined behavior.

Belief that you are skilled enough to write C/C++ code that doesn't exercise undefined behavior either shows that you don't know what is undefined behavior or that you believe you are the best programmer to have ever lived.

Re:A Guide to Undefined Behavior in C and C++ (2010) by esrauch on Sunday November 04, 2018 @06:59AM (#18375454)
Even people who work on the language spec can't really avoid writing code that hits UB without the help of sanitizers.
Re:A Guide to Undefined Behavior in C and C++ (2010) by pjmlp on Sunday November 04, 2018 @07:10AM (#18375502)
The amount of CVEs found per month on highly skilled projecs, with deep review processes, like the Linux kernel proove otherwise.

As for how well, usually conferences like CppCon have the top of the tops.

Re:A Guide to Undefined Behavior in C and C++ (2010) by nickpsecurity on Sunday November 04, 2018 @12:12PM (#18376839)
On Linux side, these slides I got from Alex Gaynor illustrate your point really well:

https://events.linuxfoundation.org/wp-content/uploads/2017/1...

There hasn't been much in terms of changes. Languages immune to classes of vulnerabilities by default and/or sound checkers that can catch all of them seem necessary. And by seem necessary, I mean massive, empirical evidence that most developers can't code safely without such alternatives even on critical, widely-used, well-funded projects.

Re:A Guide to Undefined Behavior in C and C++ (2010) by banachtarski on Sunday November 04, 2018 @02:34AM (#18374746)
Well don't use it. You aren't the target customer because for me, fixing the performance bottleneck is a lot harder than finding a divide by zero, and I certainly don't want to pay for the compiler to check things like divide-by-zero without me asking it to. When I don't care about performance, I reach for a scripting language or something. It's a tool, don't get all emotionally worked up about it.
Re:A Guide to Undefined Behavior in C and C++ (2010) by pjmlp on Sunday November 04, 2018 @04:29AM (#18375033)
We are entitled to be emotional about it, because we all have to use tools which have the misfortune to be written in C derived languages.

Even if I don't touch those languages for production code, my whole stack safety is dependent how well those underlying layers behave, and how responsibile the developers were towards writing secure core.

Which as proven by buffer oveflows in IoT devices not much.

Re:A Guide to Undefined Behavior in C and C++ (2010) by xmiller on Sunday November 04, 2018 @05:27AM (#18375198)
So where is your production code written in Ada or Pascal?
Re:A Guide to Undefined Behavior in C and C++ (2010) by pjmlp on Sunday November 04, 2018 @06:36AM (#18375379)
Ada cannot tell.

Pascal was replaced by Java and C#.

Re:A Guide to Undefined Behavior in C and C++ (2010) by jacoblambda on Sunday November 04, 2018 @12:19PM (#18376877)
Ada absolutely can tell. Divide by zero throws an exception and buffer overflows are caught by essentially every modern compiler.
Re:A Guide to Undefined Behavior in C and C++ (2010) by pjmlp on Sunday November 04, 2018 @01:49PM (#18377409)
Sure it can, but that wasn't the question. Rather what happened to the code I have written.

NDAs make us not able to tell about stuff.

What magic variant of C or C++ compiler are you using that throws errors on buffer corruption, unless you are speaking about using code with debugging mode enabled in production instead of using a proper release build.

Re:A Guide to Undefined Behavior in C and C++ (2010) by jstimpfle on Sunday November 04, 2018 @12:47PM (#18377048)
> buffer overflows are caught by essentially every modern compiler.

If you use high-level arrays with bounds-checking, which are not always fast enough, and can become a maintenaince burden. If they should be absolutely secure (like, std::vector isn't - it can be moved behind your back), they also require GC.

Re:A Guide to Undefined Behavior in C and C++ (2010) by dagenix on Sunday November 04, 2018 @03:47AM (#18374923)
> don't get all emotionally worked up about it.

Not constructive