Integer overflow Medium

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

Detector ID
javascript/integer-overflow@v1.0
Category
Common Weakness Enumeration (CWE) external icon

Noncompliant example

1function integerOverflowNoncompliant() {
2    // Noncompliant: bigint is assigned to a variable.
3    var max = 154327115334273650000012748329
4}

Compliant example

1function integerOverflowCompliant() {
2    // Compliant: n is appended to an integer which makes it a bigint.
3    var max = 154327115334273650000012748329n
4}