File tree Expand file tree Collapse file tree 2 files changed +5
-0
lines changed
rust/ql/lib/codeql/rust/dataflow/internal Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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 )
You can’t perform that action at this time.
0 commit comments