Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: added exception for bitwise numbers (a la NUM01-J)

...

NUM00-EX0: Depending on circumstances, integer overflow could be benign. For example, many algorithms for computing hash codes use modular arithmetic, intentionally allowing overflow to occur.

NUM00-EX1: Prevention of integer overflow is not necessary for numeric types that undergo bitwise operations and not arithmetic operations. For more information, see NUM01-J. Avoid performing bitwise and arithmetic operations on the same data.

Risk Assessment

Failure to perform appropriate range checking can lead to integer overflows, which can cause unexpected program control flow or unanticipated program behavior.

...

C Secure Coding Standard:

"INT32-C. Ensure that operations on signed integers do not result in overflow"

C++ Secure Coding Standard:

"INT32-CPP. Ensure that operations on signed integers do not result in overflow"

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="d934d59434eb3049-efc0c194-41214d39-8aedbd10-e40a9ed88e631cf8969b51ec"><ac:plain-text-body><![CDATA[

[ISO/IEC TR 24772:2010

http://www.aitcnet.org/isai/]

"Wrap?around Error [XYY]"

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

MITRE CWE

CWE ID 682, "Incorrect Calculation"

 

CWE ID 190, "Integer Overflow or Wraparound"

 

CWE ID 191, "Integer Underflow (Wrap or Wraparound)"

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="7d5d4e86e9737876-48b5ff0c-4200439c-9df7847e-4160b7dc35f67fd033ad6acd"><ac:plain-text-body><![CDATA[

[[API 2006

AA. Bibliography#API 06]]

class [AtomicInteger

http://download.oracle.com/javase/6/docs/api/java/util/concurrent/atomic/AtomicInteger.html]

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

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="d8818956fbe3fabe-3f48a3b8-4a0b43b8-b4f7a279-5f1d0f7aa29b81566bf016fa"><ac:plain-text-body><![CDATA[

[[Bloch 2005

AA. Bibliography#Bloch 05]]

Puzzle 27: Shifty i's

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

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="98af43016573eca3-64a255f4-408348e9-9869abb4-ef285e43a2342962c902c9fe"><ac:plain-text-body><![CDATA[

[[SCG 2009

AA. Bibliography#SCG 09]]

Introduction

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

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="f7337183118ab114-ed8babc0-48004731-b1ce82a2-cddc17f8c7505bdad6e8e28f"><ac:plain-text-body><![CDATA[

[[JLS 2005

AA. Bibliography#JLS 05]]

[§4.2.2, "Integer Operations"

http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#4.2.2]

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

 

§15.22, "Bitwise and Logical Operators"

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="f549d4672227622e-b47e3788-418f448c-8b83ace9-a6537c601def7366b4342a53"><ac:plain-text-body><![CDATA[

[[Seacord 2005

AA. Bibliography#Seacord 05]]

Chapter 5. Integers

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

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="6a8bc8bc456a8115-dfb68d0b-44534e53-b27abfbb-01110fcc453ecbfdb2c2497f"><ac:plain-text-body><![CDATA[

[[Tutorials 2008

AA. Bibliography#Tutorials 08]]

Primitive Data Types

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

...