> Their destructors will be called, in reverse order, regardless of how the function is exited.
Not in C.
Re:Apple's SSL/TLS bug
by thrownaway2424 on Saturday February 22, 2014 @01:27PM
(#7282978)
Yes, one makes a conscious choice of implementation language. They aren't dictated by the laws of physics. Choosing your implementation language is a rather important step.
Re:Apple's SSL/TLS bug
by andrewflnr on Saturday February 22, 2014 @09:03PM
(#7284613)
Indeed, a step involving more factors than simply whether the language has destructors.
Nope, it's actually pretty decent C. With a bug.
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.
There's even this bullshit:
Which is hilarious, because the only way for SSLFreeBuffer to fail is if the buffer doesn't exist, but hashCtx is a local temporary object and it MUST exist. Anyway the only thing we do by jumping to fail is to free the non-existent object once again.In short: wow.