Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Parasoft C/C++test 10.4.1 update

...

Code Block
bgColor#ccccff
languagecpp
struct B {
  virtual ~B() = default;
};
 
struct D : B {
  virtual ~D() = default;
  virtual void g() { /* ... */ }
};
 
static void (D::*gptr)() = &D::g; // Explicitly initialized.
void call_memptr(D *ptr) {
  (ptr->*gptr)();
}
 
void f() {
  D *d = new D;
  call_memptr(d);
  delete d;
}

Risk Assessment

Rule

Severity

Likelihood

Remediation Cost

Priority

Level

OOP55-CPP

High

Probable

High

P6

L2

Automated Detection

Tool

Version

Checker

Description

Parasoft C/C++test
Include Page
cplusplus:
Parasoft_V
cplusplus:
Parasoft_V
BD
CERT_CPP-
PB
OOP55-
NP
a

A cast shall not convert a pointer to a function to any other pointer type, including a pointer to function type

 

Parasoft Insure++
  


Runtime detection
 PRQA QA-C++4.1 2810, 2811, 2812, 2813, 2814 
 

Related Vulnerabilities

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

...

This rule is a subset of EXP34-C. Do not dereference null pointers.

Bibliography

[ISO/IEC 14882-2014]

Subclause 5.5, "Pointer-to-Member Operators"

 


...