Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Other uses of static assertion are shown in STR07-C. Use TR 24731 for remediation of existing string manipulation code and FIO35-C. Use feof() and ferror() to detect end-of-file and file errors when sizeof(int) == sizeof(char).

Risk Assessment

Static assertion is a valuable diagnostic tool for finding and eliminating software defects that may result in vulnerabilities at compile time. The absence of static assertions, however, does not mean that code is incorrect.

Automated Detection

Compass/ROSE could detect violations of this rule merely by looking for calls to assert(), and if it can evaluate the assertion (due to all values being known at compile time), then the code should use static-assert instead.

This assumes ROSE can recognize macro invocation.

Risk Assessment

Static assertion is a valuable diagnostic tool for finding and eliminating software defects that may result in vulnerabilities at compile time. The absence of static assertions, however, does not mean that code is incorrect.

Recommendation

Severity

Likelihood

Remediation Cost

Priority

Level

DCL03-C

low

unlikely

high

P1

L3

...