Radix or precision arguments of Number-related functions should not exceed the limit
- NUMBER_ARG_OUT_OF_RANGE
- Error
- High
- cwe
This rule applies when radix or precision arguments of Number-related functions, e.g. toString()
, are not in the permitted range.
It can be applied to the following functions:
Number.prototype.toString()
: 2~36Number.prototype.toFixed()
: 0~20Number.prototype.toExponential()
: 0~20Number.prototype.toPrecision()
: 1~21
Noncompliant Code Example
View with compliant examples side by sidevar x = 42;
var s_radix_64 = x.toString(64); // NUMBER_ARG_OUT_OF_RANGE alarm
Compliant Code Example
View with noncompliant examples side by sidevar x = 42;
var s_radix_16 = x.toString(16);
Version
This rule was introduced in DeepScan 1.0.0-alpha.