Integer overflow Medium

An integer overflow might occur when the input or resulting value is too large to store in associated representation. This can result in a critical security issue when it is used to make security decisions.

Detector ID
Common Weakness Enumeration (CWE) external icon

Noncompliant example

3def integer_overflow_noncompliant():
4    # Noncompliant: Number larger than limit of the datatype is stored.
5    arr = np.array([[100000000]], dtype=np.int8)

Compliant example

1def integer_overflow_compliant(self, request_items):
2    # Compliant: Number stored is within the limits of the specified datatype.
3    arr = np.array([100000000], dtype=np.int32)