Live data from Hacker News

Goto fail

opensource.apple.com

21–30 of 32 posts

Re: Goto fail

#21
post #8

If you missed it the 35th and 36th occurance of goto fail that really does go directly to fail. if ((err = SSLHashSHA1.update(&hashCtx, &signedParams)) != 0) goto fail; goto fail; Compulsory bracing of blocks following if/while etc is a piece of syntax Perl got 100% right. Python also got it right in a different way with whitespace. C and C++ really don't have an excuse for not MANDATING compiler warnings at a minimu…

Good catch ! Thanks for pointing that out.

Re: Goto fail

#22
post #14
post #8

If you missed it the 35th and 36th occurance of goto fail that really does go directly to fail. if ((err = SSLHashSHA1.update(&hashCtx, &signedParams)) != 0) goto fail; goto fail; Compulsory bracing of blocks following if/while etc is a piece of syntax Perl got 100% right. Python also got it right in a different way with whitespace. C and C++ really don't have an excuse for not MANDATING compiler warnings at a minimu…

> If you missed it the 35th and 36th occurance of goto fail that really does go directly to fail Whoa, that was entirely unclear from the submission that this was the point. But then, I guess I still don't see what is the point. Why post this here and not file a bug or something?

It's likely the cause for this issue:

http://support.apple.com/kb/HT6147

Reported Nov 28th (!):

http://i.imgur.com/CoALymQ.png

https://gist.github.com/rmoriz/fb2b0a6a0ce10550ab73

Re: Goto fail

#23

Two consecutive goto fail statements, but no unreachable code warning in the builds?

I'm convinced the warnings are there, but were ignored.

EDIT: The compiler I use( based on lcc ), gives an Unreachable code warning.

Re: Goto fail

#28
post #23

Two consecutive goto fail statements, but no unreachable code warning in the builds?

I'm convinced the warnings are there, but were ignored. EDIT: The compiler I use( based on lcc ), gives an Unreachable code warning.

I wonder if the goto confuses the compiler

> https://www.imperialviolet.org/2014/02/22/applebug.html

> If I compile with -Wall (enable all warnings), neither GCC 4.8.2 or Clang 3.3 from Xcode make a peep about the dead code.

Re: Goto fail

#29
post #17
post #8

If you missed it the 35th and 36th occurance of goto fail that really does go directly to fail. if ((err = SSLHashSHA1.update(&hashCtx, &signedParams)) != 0) goto fail; goto fail; Compulsory bracing of blocks following if/while etc is a piece of syntax Perl got 100% right. Python also got it right in a different way with whitespace. C and C++ really don't have an excuse for not MANDATING compiler warnings at a minimu…

> If you missed it the 35th and 36th occurance of goto fail that really does go directly to fail. Yes, I and many others seem to have missed it. That is a legitimate bug. I think the post title should highlight this issue. Now it seems like it's just a "goto is bad but apple uses it anyway" post without much point.

It's kind of a pun (probably unintentional) in that there is a particular erroneous goto statement, i.e. a "goto fail".

Re: Goto fail

#30

What's the point of this post? If you're unfamiliar with "goto fail" in C code... it's a very common error handling pattern. I'm working on some ffmpeg code at the moment. ffmpeg 2.0 contains 554 occurrences of "goto fail". Edit: okay, it appears that the point of OP's post is that someone appears to have copy/pasted an extra "goto fail" at line 631, short circuiting the remainder of the SSLVerifySignedServerKeyExcha…

Apparently that was it.

http://www.reuters.com/article/2014/02/22/us-apple-flaw-idUS...

http://www.zdnet.com/major-apple-security-flaw-patch-issued-...

Post reply on HN