@@ -73,14 +73,14 @@ signature module ModelGeneratorCommonInputSig<LocationSig Location, InputSig<Loc
7373 * `pos` of callable `c`.
7474 */
7575 bindingset [ c]
76- string paramReturnNodeAsOutput ( Callable c , Lang:: ParameterPosition p ) ;
76+ string paramReturnNodeAsApproximateOutput ( Callable c , Lang:: ParameterPosition p ) ;
7777
7878 /**
7979 * Gets the MaD string representation of return through parameter at position
8080 * `pos` of callable `c` when used in content flow.
8181 */
8282 bindingset [ c]
83- string paramReturnNodeAsContentOutput ( Callable c , Lang:: ParameterPosition pos ) ;
83+ string paramReturnNodeAsExactOutput ( Callable c , Lang:: ParameterPosition pos ) ;
8484
8585 /**
8686 * Gets the enclosing callable of `ret`.
@@ -95,13 +95,13 @@ signature module ModelGeneratorCommonInputSig<LocationSig Location, InputSig<Loc
9595 /**
9696 * Gets the MaD string representation of the parameter `p`.
9797 */
98- string parameterAccess ( Parameter p ) ;
98+ string parameterApproximateAccess ( Parameter p ) ;
9999
100100 /**
101101 * Gets the MaD string representation of the parameter `p`
102102 * when used in content flow.
103103 */
104- string parameterContentAccess ( Parameter p ) ;
104+ string parameterExactAccess ( Parameter p ) ;
105105
106106 /**
107107 * Gets the MaD string representation of the qualifier.
@@ -226,8 +226,12 @@ module MakeModelGeneratorFactory<
226226 containerContent ( c )
227227 }
228228
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 )
231235 }
232236
233237 /**
@@ -320,6 +324,16 @@ module MakeModelGeneratorFactory<
320324 DataFlowSummaryTargetApi ( ) { not isUninterestingForDataFlowModels ( this ) }
321325 }
322326
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+
323337 /**
324338 * Provides classes and predicates related to capturing summary models
325339 * based on heuristic data flow.
@@ -336,8 +350,8 @@ module MakeModelGeneratorFactory<
336350 /**
337351 * Gets the MaD string representation of the parameter node `p`.
338352 */
339- string parameterNodeAsInput ( DataFlow:: ParameterNode p ) {
340- result = parameterAccess ( asParameter ( p ) )
353+ private string parameterNodeAsApproximateInput ( DataFlow:: ParameterNode p ) {
354+ result = parameterApproximateAccess ( asParameter ( p ) )
341355 or
342356 result = qualifierString ( ) and p instanceof InstanceParameterNode
343357 }
@@ -545,16 +559,19 @@ module MakeModelGeneratorFactory<
545559 ReturnNodeExt returnNodeExt , string output , boolean preservesValue
546560 ) {
547561 (
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
549566 or
550567 not PropagateDataFlow:: flow ( p , returnNodeExt ) and
551568 PropagateTaintFlow:: flow ( p , returnNodeExt ) and
569+ input = parameterNodeAsApproximateInput ( p ) and
570+ output = getApproximateOutput ( returnNodeExt ) and
552571 preservesValue = false
553572 ) and
554573 getEnclosingCallable ( p ) = api and
555574 getEnclosingCallable ( returnNodeExt ) = api and
556- input = parameterNodeAsInput ( p ) and
557- output = getOutput ( returnNodeExt ) and
558575 input != output
559576 }
560577
@@ -651,20 +668,6 @@ module MakeModelGeneratorFactory<
651668 private module ContentModelPrinting =
652669 Printing:: ModelPrintingSummary< ContentModelPrintingInput > ;
653670
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-
668671 private string getContent ( PropagateContentFlow:: AccessPath ap , int i ) {
669672 result = "." + printContent ( ap .getAtIndex ( i ) )
670673 }
@@ -740,8 +743,8 @@ module MakeModelGeneratorFactory<
740743 PropagateContentFlow:: AccessPath stores
741744 |
742745 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 )
745748 )
746749 ) <= 3
747750 }
@@ -948,8 +951,8 @@ module MakeModelGeneratorFactory<
948951 PropagateContentFlow:: AccessPath reads , PropagateContentFlow:: AccessPath stores
949952 |
950953 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
953956 input != output and
954957 validateAccessPath ( reads ) and
955958 validateAccessPath ( stores ) and
@@ -1174,7 +1177,7 @@ module MakeModelGeneratorFactory<
11741177 sourceNode ( source , kind ) and
11751178 api = getEnclosingCallable ( sink ) and
11761179 not irrelevantSourceSinkApi ( getEnclosingCallable ( source ) , api ) and
1177- result = ModelPrintingSourceOrSink:: asSourceModel ( api , getOutput ( sink ) , kind )
1180+ result = ModelPrintingSourceOrSink:: asSourceModel ( api , getExactOutput ( sink ) , kind )
11781181 )
11791182 }
11801183 }
0 commit comments