...
Using the write()
method to output integers outside the range 0 to 255 will result in truncation.
Rule | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
FIO09-J | Low | Unlikely | Medium | P2 | L3 |
Automated Detection
Automated detection of all uses of the write()
method is straightforward. Sound determination of whether the truncating behavior is correct is not feasible in the general case. Heuristic checks could be useful.
Tool | Version | Checker | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
CodeSonar |
| JAVA.NULL.RET.UNCHECKED | Call Might Return Null (Java) | ||||||
Coverity | 7.5 | CHECKED_RETURN | Implemented | ||||||
Parasoft Jtest |
| CERT.FIO09.ARGWRITE | Do not rely on the write() method to output integers outside the range 0 to 255 |
Related Guidelines
Bibliography
[API 2014] | Class OutputStream |
...
...