Skip to content

Commit 3493c93

Browse files
authored
Merge pull request #4218 from MathiasVP/mathiasvp/fix-fp-av82
C++: Add cases for conditional and comma operator in AV Rule 82
2 parents 3a7bf2a + b3d18ef commit 3493c93

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

cpp/ql/src/jsf/4.10 Classes/AV Rule 82.ql

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ predicate dereferenceThis(Expr e) {
4545
or
4646
// `*this = ...` (where `=` is not overloaded, so an `AssignExpr`)
4747
dereferenceThis(e.(AssignExpr).getLValue())
48+
or
49+
// `e ? ... : ... `
50+
exists(ConditionalExpr cond |
51+
cond = e and
52+
dereferenceThis(cond.getThen()) and
53+
dereferenceThis(cond.getElse())
54+
)
55+
or
56+
// `..., ... `
57+
dereferenceThis(e.(CommaExpr).getRightOperand())
4858
}
4959

5060
/**

0 commit comments

Comments
 (0)