...
Code Block |
---|
void walk(vector<Base*>bar) { for_each (bar.begin(), bar.end(), mem_fun(&Base::func)); } int main(void) { vector<Base*> dis(3); for (int i=0; i<3; i++) dis[i] = new Base; vector<Base*> dat(3); for (int i=0; i<3; i++) dat[i] = new Derived; walk(dis); walk(dat); } |
...
Priority: P9 Level: L2
Using arrays polymorphically can result in memory corruption which could lead to an attacker being able to execute arbitrary code.
Component | Value |
---|---|
Severity | 3 (high) |
Likelihood | 3 (likely) |
Remediation cost | 1 (high) |
References
- Sutter 04 Item 100: Don't treat arrays polymorphically.
...