Skip to content

Commit 24360d3

Browse files
committed
C++: Fix join order in AV rule 79 by joining with GVN after the recursive call.
1 parent 72ae902 commit 24360d3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,17 @@ private predicate exprReleases(Expr e, Expr released, string kind) {
9191
// `e` is a call to a release function and `released` is the released argument
9292
releaseExpr(e, released, kind)
9393
or
94-
exists(Function f, int arg |
94+
exists(int arg, VariableAccess access, Function f |
9595
// `e` is a call to a function that releases one of it's parameters,
9696
// and `released` is the corresponding argument
9797
(
9898
e.(FunctionCall).getTarget() = f or
9999
e.(FunctionCall).getTarget().(MemberFunction).getAnOverridingFunction+() = f
100100
) and
101+
access = f.getParameter(arg).getAnAccess() and
101102
e.(FunctionCall).getArgument(arg) = released and
102103
exprReleases(_,
103-
exprOrDereference(globalValueNumber(f.getParameter(arg).getAnAccess()).getAnExpr()), kind)
104+
pragma[only_bind_into](exprOrDereference(globalValueNumber(access).getAnExpr())), kind)
104105
)
105106
or
106107
exists(Function f, ThisExpr innerThis |
@@ -112,7 +113,7 @@ private predicate exprReleases(Expr e, Expr released, string kind) {
112113
) and
113114
e.(FunctionCall).getQualifier() = exprOrDereference(released) and
114115
innerThis.getEnclosingFunction() = f and
115-
exprReleases(_, globalValueNumber(innerThis).getAnExpr(), kind)
116+
exprReleases(_, pragma[only_bind_into](globalValueNumber(innerThis).getAnExpr()), kind)
116117
)
117118
}
118119

0 commit comments

Comments
 (0)