Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

There are 22 possible narrowing primitive conversions in Java. According to the Java Language Specification, §5.1.3, "Narrowing Primitive Conversions" ,:

  • short to byte or char
  • char to byte or short
  • int to byte, short, or char
  • long to byte, short, char, or int
  • float to byte, short, char, int, or long
  • double to byte, short, char, int, long, or float

...

The CERT 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

The CERT 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="8bd2f1c3e8aa4431-8aeb5d68-452a4a49-84ca91ac-bff6d268af4711c9220eff51"><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>

MITRE CWE

CWE-681, "Incorrect Conversion between Numeric Types"

 

CWE-197, "Numeric Truncation Error"

...