A longstanding GnuTLS certificate validation botch
Posted Mar 7, 2014 10:20 UTC (Fri) by smurf (subscriber, #17840)
Posted Mar 7, 2014 10:51 UTC (Fri) by hummassa (subscriber, #307)
Now it seems that you're trolling. Which failure modes are those? The only failure modes I see in C++ are the C-related ones (null pointer dereferencing, buffer overflows, integer overflows and underflows).
Posted Mar 7, 2014 12:22 UTC (Fri) by nix (subscriber, #2304)
Posted Mar 7, 2014 19:34 UTC (Fri) by hummassa (subscriber, #307)
> Exception throws from unexpected places
those, nowadays, call unexpected() instead of "leaving the program in an inconsistent state". unexpected(), left to its own devices, will abort the program.
Posted Mar 7, 2014 20:37 UTC (Fri) by cesarb (subscriber, #6266)
That's only if you are using exception specifications, which is AFAIK not recommended (except for C++0x's nothrow).
I think what nix meant is: if you are not very careful, you can write code which is not exception-safe. An exception thrown in the middle of that code will lead to inconsistent state. RAII helps a lot, but not everything can easily be expressed in RAII style.
And even if you are very careful, code can have bugs. Exception-safety bugs can be quite hard to see by just reading the code: you have to consider that every line of code within a function could throw an exception. Even apparently innocent code like "a = b + c;" can throw an exception, courtesy of operator overloading.
Contrast this with C, where only function calls can do nonlocal exits, and even then only in the presence of longjmp(). Most functions will not call longjmp() (and if you use it from a signal handler, you deserve to lose). In C, the code flow is much simpler: it's all explicit, and visible by looking at the function's body. Even gcc's cleanup extension does not change that.
Posted Mar 8, 2014 23:15 UTC (Sat) by nix (subscriber, #2304)
I like exceptions, but I'm wary of them in much the same way as I would be of a gun that has a habit of firing spontaneously and exploding when fired. :)
Copyright © 2018, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds