@@ -73,14 +73,14 @@ signature module ModelGeneratorCommonInputSig<LocationSig Location, InputSig<Loc
73
73
* `pos` of callable `c`.
74
74
*/
75
75
bindingset [ c]
76
- string paramReturnNodeAsOutput ( Callable c , Lang:: ParameterPosition p ) ;
76
+ string paramReturnNodeAsApproximateOutput ( Callable c , Lang:: ParameterPosition p ) ;
77
77
78
78
/**
79
79
* Gets the MaD string representation of return through parameter at position
80
80
* `pos` of callable `c` when used in content flow.
81
81
*/
82
82
bindingset [ c]
83
- string paramReturnNodeAsContentOutput ( Callable c , Lang:: ParameterPosition pos ) ;
83
+ string paramReturnNodeAsExactOutput ( Callable c , Lang:: ParameterPosition pos ) ;
84
84
85
85
/**
86
86
* Gets the enclosing callable of `ret`.
@@ -95,13 +95,13 @@ signature module ModelGeneratorCommonInputSig<LocationSig Location, InputSig<Loc
95
95
/**
96
96
* Gets the MaD string representation of the parameter `p`.
97
97
*/
98
- string parameterAccess ( Parameter p ) ;
98
+ string parameterApproximateAccess ( Parameter p ) ;
99
99
100
100
/**
101
101
* Gets the MaD string representation of the parameter `p`
102
102
* when used in content flow.
103
103
*/
104
- string parameterContentAccess ( Parameter p ) ;
104
+ string parameterExactAccess ( Parameter p ) ;
105
105
106
106
/**
107
107
* Gets the MaD string representation of the qualifier.
@@ -226,8 +226,12 @@ module MakeModelGeneratorFactory<
226
226
containerContent ( c )
227
227
}
228
228
229
- private string getOutput ( ReturnNodeExt node ) {
230
- result = PrintReturnNodeExt< paramReturnNodeAsOutput / 2 > :: getOutput ( node )
229
+ private string getApproximateOutput ( ReturnNodeExt node ) {
230
+ result = PrintReturnNodeExt< paramReturnNodeAsApproximateOutput / 2 > :: getOutput ( node )
231
+ }
232
+
233
+ private string getExactOutput ( ReturnNodeExt node ) {
234
+ result = PrintReturnNodeExt< paramReturnNodeAsExactOutput / 2 > :: getOutput ( node )
231
235
}
232
236
233
237
/**
@@ -320,6 +324,16 @@ module MakeModelGeneratorFactory<
320
324
DataFlowSummaryTargetApi ( ) { not isUninterestingForDataFlowModels ( this ) }
321
325
}
322
326
327
+ /**
328
+ * Gets the MaD string representation of the parameter `p`
329
+ * when used in exact flow.
330
+ */
331
+ private string parameterNodeAsExactInput ( DataFlow:: ParameterNode p ) {
332
+ result = parameterExactAccess ( asParameter ( p ) )
333
+ or
334
+ result = qualifierString ( ) and p instanceof InstanceParameterNode
335
+ }
336
+
323
337
/**
324
338
* Provides classes and predicates related to capturing summary models
325
339
* based on heuristic data flow.
@@ -336,8 +350,8 @@ module MakeModelGeneratorFactory<
336
350
/**
337
351
* Gets the MaD string representation of the parameter node `p`.
338
352
*/
339
- string parameterNodeAsInput ( DataFlow:: ParameterNode p ) {
340
- result = parameterAccess ( asParameter ( p ) )
353
+ private string parameterNodeAsApproximateInput ( DataFlow:: ParameterNode p ) {
354
+ result = parameterApproximateAccess ( asParameter ( p ) )
341
355
or
342
356
result = qualifierString ( ) and p instanceof InstanceParameterNode
343
357
}
@@ -545,16 +559,19 @@ module MakeModelGeneratorFactory<
545
559
ReturnNodeExt returnNodeExt , string output , boolean preservesValue
546
560
) {
547
561
(
548
- PropagateDataFlow:: flow ( p , returnNodeExt ) and preservesValue = true
562
+ PropagateDataFlow:: flow ( p , returnNodeExt ) and
563
+ input = parameterNodeAsExactInput ( p ) and
564
+ output = getExactOutput ( returnNodeExt ) and
565
+ preservesValue = true
549
566
or
550
567
not PropagateDataFlow:: flow ( p , returnNodeExt ) and
551
568
PropagateTaintFlow:: flow ( p , returnNodeExt ) and
569
+ input = parameterNodeAsApproximateInput ( p ) and
570
+ output = getApproximateOutput ( returnNodeExt ) and
552
571
preservesValue = false
553
572
) and
554
573
getEnclosingCallable ( p ) = api and
555
574
getEnclosingCallable ( returnNodeExt ) = api and
556
- input = parameterNodeAsInput ( p ) and
557
- output = getOutput ( returnNodeExt ) and
558
575
input != output
559
576
}
560
577
@@ -651,20 +668,6 @@ module MakeModelGeneratorFactory<
651
668
private module ContentModelPrinting =
652
669
Printing:: ModelPrintingSummary< ContentModelPrintingInput > ;
653
670
654
- private string getContentOutput ( ReturnNodeExt node ) {
655
- result = PrintReturnNodeExt< paramReturnNodeAsContentOutput / 2 > :: getOutput ( node )
656
- }
657
-
658
- /**
659
- * Gets the MaD string representation of the parameter `p`
660
- * when used in content flow.
661
- */
662
- private string parameterNodeAsContentInput ( DataFlow:: ParameterNode p ) {
663
- result = parameterContentAccess ( asParameter ( p ) )
664
- or
665
- result = qualifierString ( ) and p instanceof InstanceParameterNode
666
- }
667
-
668
671
private string getContent ( PropagateContentFlow:: AccessPath ap , int i ) {
669
672
result = "." + printContent ( ap .getAtIndex ( i ) )
670
673
}
@@ -740,8 +743,8 @@ module MakeModelGeneratorFactory<
740
743
PropagateContentFlow:: AccessPath stores
741
744
|
742
745
apiFlow ( this , parameter , reads , returnNodeExt , stores , _) and
743
- input = parameterNodeAsContentInput ( parameter ) + printReadAccessPath ( reads ) and
744
- output = getContentOutput ( returnNodeExt ) + printStoreAccessPath ( stores )
746
+ input = parameterNodeAsExactInput ( parameter ) + printReadAccessPath ( reads ) and
747
+ output = getExactOutput ( returnNodeExt ) + printStoreAccessPath ( stores )
745
748
)
746
749
) <= 3
747
750
}
@@ -948,8 +951,8 @@ module MakeModelGeneratorFactory<
948
951
PropagateContentFlow:: AccessPath reads , PropagateContentFlow:: AccessPath stores
949
952
|
950
953
apiRelevantContentFlow ( api , p , reads , returnNodeExt , stores , preservesValue ) and
951
- input = parameterNodeAsContentInput ( p ) + printReadAccessPath ( reads ) and
952
- output = getContentOutput ( returnNodeExt ) + printStoreAccessPath ( stores ) and
954
+ input = parameterNodeAsExactInput ( p ) + printReadAccessPath ( reads ) and
955
+ output = getExactOutput ( returnNodeExt ) + printStoreAccessPath ( stores ) and
953
956
input != output and
954
957
validateAccessPath ( reads ) and
955
958
validateAccessPath ( stores ) and
@@ -1174,7 +1177,7 @@ module MakeModelGeneratorFactory<
1174
1177
sourceNode ( source , kind ) and
1175
1178
api = getEnclosingCallable ( sink ) and
1176
1179
not irrelevantSourceSinkApi ( getEnclosingCallable ( source ) , api ) and
1177
- result = ModelPrintingSourceOrSink:: asSourceModel ( api , getOutput ( sink ) , kind )
1180
+ result = ModelPrintingSourceOrSink:: asSourceModel ( api , getExactOutput ( sink ) , kind )
1178
1181
)
1179
1182
}
1180
1183
}
0 commit comments