...
Code Block | ||||
---|---|---|---|---|
| ||||
float calc_percentage(float value) { return (float)(value * 0.1f); } void float_routine(void) { float value = 99.0f; long double percentage; percentage = calc_percentage(value); } |
Forcing the range and precision inside the calcPercentage()
function is a good way to fix the problem once without having to apply fixes in multiple locations (every time calcPercentage()
is called).
...
Failure to follow this guideline can lead to inconsistent results across different platforms.
Rule | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
FLP07-C | Low | Probable | Medium | P4 | L3 |
Automated Detection
Tool | Version | Checker | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
Axivion Bauhaus Suite |
| CertC-FLP07 |
Related Vulnerabilities
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
Bibliography
[ISO/IEC 9899:2011] | Subclause 6.8.6.4, "The return Statement"Annex F.6, "The return Statement" |
[WG14/N1396] |
...
...