...
Code Block |
---|
int i = // initialize to user supplied value if ((i >= 0) && ((i++) <= Integer.MAX_VALUE)) { // ... } |
...
Code Block |
---|
if (data != null && i < data.length && 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 &&" 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 |
...