4 ms·
With the supposedly error prone whitespace syntax, the following code would generate an unreachable code warning instead of causing CVE-2014-1266. if ((err
by the_why_of_y 11y ago
With the supposedly error prone whitespace syntax, the following code would generate an unreachable code warning instead of causing CVE-2014-1266.
if ((err = SSLHashSHA1.update(&hashCtx, &signedParams)) != 0)
goto fail;
goto fail;
IMHO if the indentation of the code does not match the brace structure, that is highly suspicious and often very difficult to spot by manual code review, so it should not compile without any warning or error, but I'm not aware of any C-style syntax language implementation that does that.
- shmerl 11y agoI always follow the style of using braces for if statements in C++ and C (unless it's just a simple one liner). I.e. never write if ((err = SSLHashSHA1.update(&hashCtx, &signedParams)) != 0) goto fail; Write if ((err = SSLHashSHA1.update(&hashCtx, &signedParams)) != 0) { goto fail; }
- cballard 11y agoSwift does not allow code blocks after an if statement without curly brackets, so this is not an issue.