...
Integer type ranges are defined by the JLS, §4.2.1, "Integral Types and Values", [JLS 2005] and are also described in rule "NUM16NUM00-J. Detect or prevent integer overflow."
The table below presents the rules for narrowing primitive conversions of integer types. In the table, for an integer type T, n represents the number of bits used to represent the resulting type T (precision).
...
C Secure Coding Standard | "INT31-C. Ensure that integer conversions do not result in lost or misinterpreted data" | |||
| "FLP34-C. Ensure that floating point conversions are within range of the new type" | |||
C++ Secure Coding Standard | "INT31-CPP. Ensure that integer conversions do not result in lost or misinterpreted data" | |||
| "FLP34-CPP. Ensure that floating point conversions are within range of the new type" | |||
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="e18d76876783a726-9f67b24e-4d3d47a1-87708b8d-952a332c89469b0dbda50bb8"><ac:plain-text-body><![CDATA[ | [ISO/IEC TR 24772:2010 | http://www.aitcnet.org/isai/] | "Numeric Conversion Errors [FLC]" | ]]></ac:plain-text-body></ac:structured-macro> |
CWE ID 681, "Incorrect Conversion between Numeric Types" | ||||
| CWE ID 197, "Numeric Truncation Error" |
...