Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Edited by sciSpider (sch jbop) (X_X)@==(Q_Q)@

...

Code Block
bgColor#ccccff
float x, result;

if ( islessequal(x,-1) || isgreaterequal(x, 1) ){
     /* handle domain error */
}

result = acos(x);

...

Code Block
bgColor#ccccff
float x, y, result;

if ( fpclassify(x) == FP_ZERO && fpclassify(y) == FP_ZERO){
     /* handle domain error */
}

result = atan2(y, x);

...

Code Block
bgColor#ccccff
float result, x;

if (islessequal(x, 0)){
     /* handle domain and range errors */
}

result = log(x);

...

Code Block
bgColor#FFcccc
float x, y, result;

result = pow(x, y);

Compliant Solution

This code tests x and y to ensure that there will be no range or domain errors.

Code Block
bgColor#ccccff
float x, y, result;

if (fpclassify(x) == FP_ZERO && islessequal(y, 0)){
     /* handle domain error condition */
}

result = pow(x, y);

...

Code Block
bgColor#ccccff
float x, result;

if (isless(x, 0)){
     /* handle domain error */
}

result = sqrt(x);

...

Rule

Severity

Likelihood

Remediation Cost

Priority

Level

FLP32-C

2 (medium)

2 (probable)

2 (medium)

P8

L2

Related Vulnerabilities

Search for vulnerabilities resulting from the violation of this rule on the CERT website.

Search for vulnerabilities resulting from the violation of this rule on the CERT website

...