Address review comments

This commit is contained in:
Tom Hvitved
2025-12-08 13:27:36 +01:00
parent 5a5679bd51
commit 57ce2ee749
2 changed files with 5 additions and 0 deletions

View File

@@ -428,6 +428,9 @@ module RustDataFlow implements InputSig<Location> {
private Function getStaticTargetExt(Call c) {
result = c.getStaticTarget()
or
// If the static target of an overloaded operation cannot be resolved, we fall
// back to the trait method as the target. This ensures that the flow models
// still apply.
not exists(c.getStaticTarget()) and
exists(TraitItemNode t, string methodName |
c.(Operation).isOverloaded(t, methodName, _) and

View File

@@ -554,6 +554,8 @@ newtype TNode =
e.hasEnclosingCfgScope() and
(
isArgumentForCall(e, _, _) and
// For compound assignments into variables like `x += y`, we do not want flow into
// `[post] x`, as that would create spurious flow when `x` is a parameter.
not (e = any(CompoundAssignmentExpr cae).getLhs() and e instanceof VariableAccess)
or
lambdaCallExpr(_, _, e)