...
Code Block | ||
---|---|---|
| ||
BufferedReader br; // Set up the BufferedReader br String line; // ... line = br.readLine(); if (line == null) { // handle error } |
...
Applicability
Assertions are a valuable diagnostic tool for finding and eliminating software defects that may result in vulnerabilities. The absence of assertions, however, does not mean that code is incorrect.
Guideline | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
MSC55-JG | low | unlikely | high | P1 | L3 |
...
In general, the misuse of the assert
statement for runtime checking rather than checking for logical errors cannot be detected automatically.
Related Vulnerabilities
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
Related Guidelines
C Secure Coding Standard: MSC11-C. Incorporate diagnostic tests using assertions
C++ Secure Coding Standard: MSC11-CPP. Incorporate diagnostic tests using assertions
Bibliography
[JLS 2011] | Section 14§14.10, The assert Statement |