9
9
private import FlowSummaryImplSpecific
10
10
private import DataFlowImplSpecific:: Private
11
11
private import DataFlowImplSpecific:: Public
12
- private import DataFlowImplCommon as DataFlowImplCommon
12
+ private import DataFlowImplCommon
13
13
14
14
/** Provides classes and predicates for defining flow summaries. */
15
15
module Public {
@@ -295,7 +295,7 @@ module Private {
295
295
or
296
296
exists ( int i |
297
297
parameterReadState ( c , state , i ) and
298
- result .( ParameterNode ) .isParameterOf ( c , i )
298
+ result .( ParamNode ) .isParameterOf ( c , i )
299
299
)
300
300
)
301
301
}
@@ -421,7 +421,7 @@ module Private {
421
421
}
422
422
423
423
/** Holds if summary node `post` is a post-update node with pre-update node `pre`. */
424
- predicate summaryPostUpdateNode ( Node post , ParameterNode pre ) {
424
+ predicate summaryPostUpdateNode ( Node post , ParamNode pre ) {
425
425
exists ( SummarizedCallable c , int i |
426
426
isParameterPostUpdate ( post , c , i ) and
427
427
pre .isParameterOf ( c , i )
@@ -493,17 +493,15 @@ module Private {
493
493
* Holds if values stored inside content `c` are cleared when passed as
494
494
* input of type `input` in `call`.
495
495
*/
496
- predicate summaryClearsContent ( ArgumentNode arg , Content c ) {
496
+ predicate summaryClearsContent ( ArgNode arg , Content c ) {
497
497
exists ( DataFlowCall call , int i |
498
498
viableCallable ( call ) .( SummarizedCallable ) .clearsContent ( i , c ) and
499
499
arg .argumentOf ( call , i )
500
500
)
501
501
}
502
502
503
503
pragma [ nomagic]
504
- private ParameterNode summaryArgParam (
505
- ArgumentNode arg , DataFlowImplCommon:: ReturnKindExt rk , DataFlowImplCommon:: OutNodeExt out
506
- ) {
504
+ private ParamNode summaryArgParam ( ArgNode arg , ReturnKindExt rk , OutNodeExt out ) {
507
505
exists ( DataFlowCall call , int pos , SummarizedCallable callable |
508
506
arg .argumentOf ( call , pos ) and
509
507
viableCallable ( call ) = callable and
@@ -519,8 +517,8 @@ module Private {
519
517
* NOTE: This step should not be used in global data-flow/taint-tracking, but may
520
518
* be useful to include in the exposed local data-flow/taint-tracking relations.
521
519
*/
522
- predicate summaryThroughStep ( ArgumentNode arg , Node out , boolean preservesValue ) {
523
- exists ( DataFlowImplCommon :: ReturnKindExt rk , DataFlowImplCommon :: ReturnNodeExt ret |
520
+ predicate summaryThroughStep ( ArgNode arg , Node out , boolean preservesValue ) {
521
+ exists ( ReturnKindExt rk , ReturnNodeExt ret |
524
522
summaryLocalStep ( summaryArgParam ( arg , rk , out ) , ret , preservesValue ) and
525
523
ret .getKind ( ) = rk
526
524
)
@@ -533,8 +531,8 @@ module Private {
533
531
* NOTE: This step should not be used in global data-flow/taint-tracking, but may
534
532
* be useful to include in the exposed local data-flow/taint-tracking relations.
535
533
*/
536
- predicate summaryGetterStep ( ArgumentNode arg , Content c , Node out ) {
537
- exists ( DataFlowImplCommon :: ReturnKindExt rk , Node mid , DataFlowImplCommon :: ReturnNodeExt ret |
534
+ predicate summaryGetterStep ( ArgNode arg , Content c , Node out ) {
535
+ exists ( ReturnKindExt rk , Node mid , ReturnNodeExt ret |
538
536
summaryReadStep ( summaryArgParam ( arg , rk , out ) , c , mid ) and
539
537
summaryLocalStep ( mid , ret , _) and
540
538
ret .getKind ( ) = rk
@@ -548,8 +546,8 @@ module Private {
548
546
* NOTE: This step should not be used in global data-flow/taint-tracking, but may
549
547
* be useful to include in the exposed local data-flow/taint-tracking relations.
550
548
*/
551
- predicate summarySetterStep ( ArgumentNode arg , Content c , Node out ) {
552
- exists ( DataFlowImplCommon :: ReturnKindExt rk , Node mid , DataFlowImplCommon :: ReturnNodeExt ret |
549
+ predicate summarySetterStep ( ArgNode arg , Content c , Node out ) {
550
+ exists ( ReturnKindExt rk , Node mid , ReturnNodeExt ret |
553
551
summaryLocalStep ( summaryArgParam ( arg , rk , out ) , mid , _) and
554
552
summaryStoreStep ( mid , c , ret ) and
555
553
ret .getKind ( ) = rk
@@ -563,12 +561,9 @@ module Private {
563
561
* definition of `clearsContent()`.
564
562
*/
565
563
predicate summaryStoresIntoArg ( Content c , Node arg ) {
566
- exists (
567
- DataFlowImplCommon:: ParamUpdateReturnKind rk , DataFlowImplCommon:: ReturnNodeExt ret ,
568
- PostUpdateNode out
569
- |
564
+ exists ( ParamUpdateReturnKind rk , ReturnNodeExt ret , PostUpdateNode out |
570
565
exists ( DataFlowCall call , SummarizedCallable callable |
571
- DataFlowImplCommon :: getNodeEnclosingCallable ( ret ) = callable and
566
+ getNodeEnclosingCallable ( ret ) = callable and
572
567
viableCallable ( call ) = callable and
573
568
summaryStoreStep ( _, c , ret ) and
574
569
ret .getKind ( ) = pragma [ only_bind_into ] ( rk ) and
@@ -740,21 +735,17 @@ module Private {
740
735
specSplit ( output , c , idx )
741
736
|
742
737
exists ( int pos |
743
- node .asNode ( )
744
- .( PostUpdateNode )
745
- .getPreUpdateNode ( )
746
- .( ArgumentNode )
747
- .argumentOf ( mid .asCall ( ) , pos )
738
+ node .asNode ( ) .( PostUpdateNode ) .getPreUpdateNode ( ) .( ArgNode ) .argumentOf ( mid .asCall ( ) , pos )
748
739
|
749
740
c = "Argument" or parseArg ( c , pos )
750
741
)
751
742
or
752
- exists ( int pos | node .asNode ( ) .( ParameterNode ) .isParameterOf ( mid .asCallable ( ) , pos ) |
743
+ exists ( int pos | node .asNode ( ) .( ParamNode ) .isParameterOf ( mid .asCallable ( ) , pos ) |
753
744
c = "Parameter" or parseParam ( c , pos )
754
745
)
755
746
or
756
747
c = "ReturnValue" and
757
- node .asNode ( ) = getAnOutNode ( mid .asCall ( ) , getReturnValueKind ( ) )
748
+ node .asNode ( ) = getAnOutNodeExt ( mid .asCall ( ) , TValueReturn ( getReturnValueKind ( ) ) )
758
749
or
759
750
interpretOutputSpecific ( c , mid , node )
760
751
)
@@ -769,15 +760,15 @@ module Private {
769
760
interpretInput ( input , idx + 1 , ref , mid ) and
770
761
specSplit ( input , c , idx )
771
762
|
772
- exists ( int pos | node .asNode ( ) .( ArgumentNode ) .argumentOf ( mid .asCall ( ) , pos ) |
763
+ exists ( int pos | node .asNode ( ) .( ArgNode ) .argumentOf ( mid .asCall ( ) , pos ) |
773
764
c = "Argument" or parseArg ( c , pos )
774
765
)
775
766
or
776
- exists ( ReturnNode ret |
767
+ exists ( ReturnNodeExt ret |
777
768
c = "ReturnValue" and
778
769
ret = node .asNode ( ) and
779
- ret .getKind ( ) = getReturnValueKind ( ) and
780
- mid .asCallable ( ) = DataFlowImplCommon :: getNodeEnclosingCallable ( ret )
770
+ ret .getKind ( ) . ( ValueReturnKind ) . getKind ( ) = getReturnValueKind ( ) and
771
+ mid .asCallable ( ) = getNodeEnclosingCallable ( ret )
781
772
)
782
773
or
783
774
interpretInputSpecific ( c , mid , node )
0 commit comments