Skip to content

Commit 0b89101

Browse files
authored
Merge pull request #1466 from geoffw0/castarrayperf
CPP: Resolve performance issue in CastArrayPointerArithmetic.ql
2 parents ba3ec50 + b9a57a4 commit 0b89101

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

cpp/ql/src/Likely Bugs/Conversion/CastArrayPointerArithmetic.ql

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,15 @@ class CastToPointerArithFlow extends DataFlow::Configuration {
4343
}
4444
}
4545

46+
/**
47+
* `derived` has a (possibly indirect) base class of `base`, and at least one new
48+
* field has been introduced in the inheritance chain after `base`.
49+
*/
4650
predicate introducesNewField(Class derived, Class base) {
47-
derived.getABaseClass+() = base and
4851
(
4952
exists(Field f |
50-
f.getDeclaringType() = derived
53+
f.getDeclaringType() = derived and
54+
derived.getABaseClass+() = base
5155
) or
5256
introducesNewField(derived.getABaseClass(), base)
5357
)

0 commit comments

Comments
 (0)