Versions Compared

Key

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

...

This code will produce unexpected results when an exceptional value is entered for val and subsequently used in calculations or as control values. The user could, for example, input the strings infinity or NaN on the command line, which would be parsed by Double.valueOf(String s) into the floating-point representations of either infinity or NaN. All subsequent calculations using these values would be invalid, possibly causing runtime exceptions or enabling denial-of-service (DoS) attacks.

In this noncompliant example, entering NaN for val would cause currentBalance to be set to NaN, corrupting its value. If this value were used in other expressions, every resulting value would also become NaN, possibly corrupting important data.

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="609a71fa7cce23b0-4963a6fc-487e4f0d-be1bae26-34b344ada0fd883df63dfa39"><ac:plain-text-body><![CDATA[

[[IEEE 754

https://www.securecoding.cert.org/confluence/display/seccode/AA.+C+References#AA.CReferences-IEEE7542006

IEEE 754]]

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="b5b3fa2df4398a88-61f68b56-498946aa-937fb7db-014ad994a88971c7eb316940"><ac:plain-text-body><![CDATA[

[[IEEE 1003.1, 2004

https://www.securecoding.cert.org/confluence/display/seccode/AA.+C+References#AA.CReferences-IEEE1003

IEEE 1003.1, 2004]]

]]></ac:plain-text-body></ac:structured-macro>

...