...
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 | ||||||
---|---|---|---|---|---|---|---|---|---|
Coverity | 7.5 | CHECKED_RETURN | Implemented | ||||||
Parasoft Jtest |
| BD.API.ARGWRITE | Do not rely on the write() method to output integers outside the range 0 to 255 |
Related Guidelines
Bibliography
[API 2014] | Class OutputStream |
...
...