Versions Compared

Key

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

...

If the object is declared as being constant, it may reside in write-protected memory at runtime. Attempting to modify such an object may lead to abnormal program termination or a denial-of-service attack. If an object is declared as being volatile, the compiler can make no assumptions regarding access of that object. Casting away the volatility of an object can result in reads or writes to the object being reordered or elided entirely, resulting in abnormal program execution.

Rule

Severity

Likelihood

Remediation Cost

Priority

Level

EXP55-CPP

Medium

Probable

Medium

P8

L2

Automated Detection

Tool

Version

Checker

Description

Astrée

Include Page
Astrée_V
Astrée_V

pointer-qualifier-cast-const
pointer-qualifier-cast-volatile
Partially checked
Axivion Bauhaus Suite

Include Page
Axivion Bauhaus Suite_V
Axivion Bauhaus Suite_V

CertC++-EXP55
Helix QAC

Include Page
Helix QAC_V
Helix QAC_V

C++3066, C++4671


Klocwork
Include Page
Klocwork_V
Klocwork_V
MISRA.CAST.CONST
 

LDRA tool suite
Include Page
LDRA_V
LDRA_V

203 S, 242 S, 344 S

Fully implemented

 PRQA QA-C++9.1  3083, 4671

Parasoft C/C++test

Include Page
Parasoft_V
Parasoft_V

CERT_CPP-EXP55-a

A cast shall not remove any 'const' or 'volatile' qualification from the type of a pointer or reference

Polyspace Bug Finder

Include Page
Polyspace Bug Finder_V
Polyspace Bug Finder_V

CERT C++: EXP55-CPPChecks for casts that remove cv-qualification of pointer (rule partially covered)
RuleChecker
Include Page
RuleChecker_V
RuleChecker_V
pointer-qualifier-cast-const
pointer-qualifier-cast-volatile
Partially checked
 
SonarQube C/C++ Plugin
Include Page
SonarQube C/C++ Plugin_V
SonarQube C/C++ Plugin_V
S859
 

Related Vulnerabilities

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

Related Guidelines

Bibliography

[ISO/IEC 14882-2014]Subclause 7.1.6.1, "The cv-qualifiers"
[Sutter 2004]Item 94, "Avoid Casting Away const"

...


...

Image Modified Image Modified Image Modified