Versions Compared

Key

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

...

The minimum and maximum float values are converted to minimum and maximum int values (0x80000000 and 0x7fffffff respectively). The resulting short values are the lower 16 bits of these values (0x0000 and 0xffff). The resulting final values (0 and -1) could might be unexpected.

Compliant Solution (Floating-Point to Integer Conversion)

...

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="f0cd9598fb819105-8bcd8ce3-4b184c25-b63b9e85-3105659eea5b08bca9f450b2"><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

...