Re:Apple's SSL/TLS bug
by kabdib on Saturday February 22, 2014 @02:19PM
(#7283193)
Nope, it's actually pretty decent C. With a bug.
[ Parent
| on HN ]
Re:Apple's SSL/TLS bug
by beachstartup on Saturday February 22, 2014 @03:09PM
(#7283393)
this pattern is structured to avoid the use of an additional stack (local) variable to track a condition, and to skip superfluous execution of code once that condition is detected.
i've used it myself to optimize inner loops of very simple un-accelerated graphics rendering code (which sped it up considerably, since it is potentially skipping many levels of unnecessary execution on the cpu, millions of times), but i agree with some posters here, using it in a security context like this is a bit daring.
still, having said that, this bug really is an indictment of the testing process and not really bad style per se.
The code already has that condition variable ('err'), the goto is to avoid execution of code that should not be executed. It's not about avoiding additional stack -- that was probably the last thing on the programmer's mind. The idiom is about error handling.
Re:Apple's SSL/TLS bug
by beachstartup on Saturday February 22, 2014 @10:35PM
(#7284819)
i didn't see that. that makes it even worse. this design is supposed to avoid that extra var.