Skip to content

Commit 57ce2ee

Browse files
committed
Address review comments
1 parent 5a5679b commit 57ce2ee

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

rust/ql/lib/codeql/rust/dataflow/internal/DataFlowImpl.qll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,9 @@ module RustDataFlow implements InputSig<Location> {
428428
private Function getStaticTargetExt(Call c) {
429429
result = c.getStaticTarget()
430430
or
431+
// If the static target of an overloaded operation cannot be resolved, we fall
432+
// back to the trait method as the target. This ensures that the flow models
433+
// still apply.
431434
not exists(c.getStaticTarget()) and
432435
exists(TraitItemNode t, string methodName |
433436
c.(Operation).isOverloaded(t, methodName, _) and

rust/ql/lib/codeql/rust/dataflow/internal/Node.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,8 @@ newtype TNode =
554554
e.hasEnclosingCfgScope() and
555555
(
556556
isArgumentForCall(e, _, _) and
557+
// For compound assignments into variables like `x += y`, we do not want flow into
558+
// `[post] x`, as that would create spurious flow when `x` is a parameter.
557559
not (e = any(CompoundAssignmentExpr cae).getLhs() and e instanceof VariableAccess)
558560
or
559561
lambdaCallExpr(_, _, e)

0 commit comments

Comments
 (0)