Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Reverted from v. 18

...

Code Block
int i = // initialize to user supplied value 
if ((i >= 0) &amp;&amp; ((i++) <= Integer.MAX_VALUE)) {
  // ...
}

...

Code Block
if (data != null &amp;&amp; i < data.length &amp;&amp; data[i] != -1) ... 

This code snippet sequentially executes the subexpressions while avoiding an array indexing exception resulting from the checks that execute prior to the last subexpression.

...

Search for vulnerabilities resulting from the violation of this rule on the CERT website.

References

Wiki Markup
\[[JLS 05|AA. Java References#JLS 05]\] Sections [15.23|http://java.sun.com/docs/books/jls/third_edition/html/expressions.html#15.23] "Conditional-And Operator &amp;&amp;" and [15.24|http://java.sun.com/docs/books/jls/third_edition/html/expressions.html#15.24] "Conditional-Or Operator ||"
\[[Flanagan 05|AA. Java References#Flanagan 05]\] 2.5.6. Boolean Operators

...