Skip to content

Commit 77c983b

Browse files
authored
Merge pull request #1070 from jbj/dataflow-defbyref-join-order
C++: Fix join order in def-by-reference data flow
2 parents 9758164 + ece122a commit 77c983b

File tree

1 file changed

+7
-8
lines changed
  • cpp/ql/src/semmle/code/cpp/dataflow/internal

1 file changed

+7
-8
lines changed

cpp/ql/src/semmle/code/cpp/dataflow/internal/FlowVar.qll

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -237,15 +237,8 @@ module FlowVar_internal {
237237

238238
override VariableAccess getAnAccess() {
239239
exists(SubBasicBlock reached |
240-
reached = getAReachedBlockVarSBB(this)
241-
|
240+
reached = getAReachedBlockVarSBB(this) and
242241
variableAccessInSBB(v, reached, result)
243-
or
244-
// Allow flow into a `VariableAccess` that is used as definition by
245-
// reference. This flow is blocked by `getAReachedBlockVarSBB` because
246-
// flow should not propagate past that.
247-
result = reached.getASuccessor().(VariableAccess) and
248-
blockVarDefinedByReference(result, v, _)
249242
)
250243
}
251244

@@ -420,6 +413,12 @@ module FlowVar_internal {
420413
va.getTarget() = v and
421414
va = sbb.getANode() and
422415
not overwrite(va, _)
416+
or
417+
// Allow flow into a `VariableAccess` that is used as definition by
418+
// reference. This flow is blocked by `getAReachedBlockVarSBB` because
419+
// flow should not propagate past that.
420+
va = sbb.getASuccessor().(VariableAccess) and
421+
blockVarDefinedByReference(va, v, _)
423422
}
424423

425424
/**

0 commit comments

Comments
 (0)