File tree Expand file tree Collapse file tree 5 files changed +16
-5
lines changed
test/library-tests/dataflow/global Expand file tree Collapse file tree 5 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -582,6 +582,7 @@ module RustDataFlow implements InputSig<Location> {
582
582
.isVariantField ( [ any ( OptionEnum o ) .getSome ( ) , any ( ResultEnum r ) .getOk ( ) ] , 0 )
583
583
)
584
584
or
585
+ // todo: rely on flow summary instead
585
586
exists ( PrefixExprCfgNode deref |
586
587
c instanceof ReferenceContent and
587
588
deref .getOperatorName ( ) = "*" and
Original file line number Diff line number Diff line change @@ -467,7 +467,7 @@ newtype TNode =
467
467
any ( TryExprCfgNode try ) .getExpr ( ) , //
468
468
any ( PrefixExprCfgNode pe | pe .getOperatorName ( ) = "*" ) .getExpr ( ) , //
469
469
any ( AwaitExprCfgNode a ) .getExpr ( ) , //
470
- any ( MethodCallExprCfgNode mc ) .getReceiver ( ) , //
470
+ any ( CallCfgNode call | call . getCall ( ) . receiverImplicitlyBorrowed ( ) ) .getReceiver ( ) , //
471
471
getPostUpdateReverseStep ( any ( PostUpdateNode n ) .getPreUpdateNode ( ) .asExpr ( ) , _)
472
472
]
473
473
} or
Original file line number Diff line number Diff line change @@ -3482,7 +3482,15 @@ private module Cached {
3482
3482
/** Holds if `receiver` is the receiver of a method call with an implicit dereference. */
3483
3483
cached
3484
3484
predicate receiverHasImplicitDeref ( AstNode receiver ) {
3485
- none ( ) // todo
3485
+ exists ( MethodCall mc |
3486
+ exists ( resolveMethodCallTarget ( MkMethodCallDerefChainRef ( mc , ".ref;" ) ) ) and
3487
+ receiver = mc .getArgument ( CallImpl:: TSelfArgumentPosition ( ) )
3488
+ )
3489
+ or
3490
+ exists ( Op op |
3491
+ op .( Call ) .implicitBorrowAt ( CallImpl:: TSelfArgumentPosition ( ) , true ) and
3492
+ receiver = op .getOperand ( 0 )
3493
+ )
3486
3494
// exists(MethodCallExprMatchingInput::Access a, MethodCallExprMatchingInput::AccessPosition apos |
3487
3495
// apos.getArgumentPosition().isSelf() and
3488
3496
// apos.isBorrowed(_) and
@@ -3495,7 +3503,10 @@ private module Cached {
3495
3503
/** Holds if `receiver` is the receiver of a method call with an implicit borrow. */
3496
3504
cached
3497
3505
predicate receiverHasImplicitBorrow ( AstNode receiver ) {
3498
- none ( ) // todo
3506
+ exists ( MethodCall mc |
3507
+ exists ( resolveMethodCallTarget ( MkMethodCallDerefChainRef ( mc , ";ref" ) ) ) and
3508
+ receiver = mc .getArgument ( CallImpl:: TSelfArgumentPosition ( ) )
3509
+ )
3499
3510
// exists(MethodCallExprMatchingInput::Access a, MethodCallExprMatchingInput::AccessPosition apos |
3500
3511
// apos.getArgumentPosition().isSelf() and
3501
3512
// apos.isBorrowed(_) and
Original file line number Diff line number Diff line change @@ -400,6 +400,7 @@ subpaths
400
400
| main.rs:301:50:301:50 | a [MyInt] | main.rs:289:18:289:21 | SelfParam [MyInt] | main.rs:289:48:291:5 | { ... } [MyInt] | main.rs:301:30:301:54 | ...::take_self(...) [MyInt] |
401
401
| main.rs:306:55:306:55 | b [MyInt] | main.rs:293:26:293:37 | ...: MyInt [MyInt] | main.rs:293:49:295:5 | { ... } [MyInt] | main.rs:306:30:306:56 | ...::take_second(...) [MyInt] |
402
402
testFailures
403
+ | main.rs:277:14:277:58 | //... | Missing result: hasTaintFlow=28 |
403
404
#select
404
405
| main.rs:18:10:18:10 | a | main.rs:13:5:13:13 | source(...) | main.rs:18:10:18:10 | a | $@ | main.rs:13:5:13:13 | source(...) | source(...) |
405
406
| main.rs:39:10:39:21 | a.get_data() | main.rs:38:23:38:31 | source(...) | main.rs:39:10:39:21 | a.get_data() | $@ | main.rs:38:23:38:31 | source(...) | source(...) |
Original file line number Diff line number Diff line change 59
59
| main.rs:212:13:212:34 | ...::new(...) | main.rs:205:5:208:5 | fn new |
60
60
| main.rs:212:24:212:33 | source(...) | main.rs:1:1:3:1 | fn source |
61
61
| main.rs:214:5:214:11 | sink(...) | main.rs:5:1:7:1 | fn sink |
62
- | main.rs:228:10:228:14 | * ... | main.rs:235:5:237:5 | fn deref |
63
- | main.rs:236:11:236:15 | * ... | main.rs:235:5:237:5 | fn deref |
64
62
| main.rs:242:28:242:36 | source(...) | main.rs:1:1:3:1 | fn source |
65
63
| main.rs:244:13:244:17 | ... + ... | main.rs:220:5:223:5 | fn add |
66
64
| main.rs:245:5:245:17 | sink(...) | main.rs:5:1:7:1 | fn sink |
You can’t perform that action at this time.
0 commit comments