...
The following noncompliant code demonstrates the perils of operating on data of incompatible types. An attempt is made to increment an integer type cast to a floating point type , and a floating point cast to an integer type.
...
The expected result is for both values to display as 1
, ; however, on a 64-bit Linux machine, this program produces:
...
Recommendation | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
EXP11-C | medium | probable | medium | P8 | L2 |
Automated Detection
Tool | Version | Checker | Description | ||||
---|---|---|---|---|---|---|---|
|
|
|
|
Related Vulnerabilities
Search for vulnerabilities resulting from the violation of this recommendation on the CERT website.
Other Languages
Related Guidelines
This recommendation appears in the C++ Secure Coding Standard as : EXP11-CPP. Do not apply operators expecting one type to data of an incompatible type.
Bibliography
Wiki Markup |
---|
\[[ISO/IEC 9899:1999|AA. Bibliography#ISO/IEC 9899-1999]\] Section 6.7.2, "Type specifiers" \[[ISO/IEC PDTR 24772|AA. Bibliography#ISO/IEC PDTR 24772]\] "STR Bit Representations" \[[MISRA 042004|AA. Bibliography#MISRA 04]\] Rule 3.5 \[[Plum 851985|AA. Bibliography#Plum 85]\] Rule 6-5 |
...