@@ -109,35 +109,28 @@ predicate isNonConst(DataFlow::Node node) {
109109 // i.e., functions that with unknown bodies and are not known to define the output through its input
110110 // are considered as possible non-const sources
111111 // The function's output must also not be const to be considered a non-const source
112- (
112+ exists ( Function func , CallInstruction call |
113+ not func .hasDefinition ( ) and
114+ func = call .getStaticCallTarget ( )
115+ |
113116 // Case 1: It's a known dataflow or taintflow function with flow to the return value
114- exists ( Function func , CallInstruction call |
115- call .getUnconvertedResultExpression ( ) = node .asIndirectExpr ( ) and
116- func = call .getStaticCallTarget ( ) and
117- not exists ( FunctionOutput output |
118- dataFlowOrTaintFlowFunction ( func , output ) and
119- output .isReturnValueDeref ( ) and
120- node = callOutput ( call , output )
121- )
117+ call .getUnconvertedResultExpression ( ) = node .asIndirectExpr ( ) and
118+ not exists ( FunctionOutput output |
119+ dataFlowOrTaintFlowFunction ( func , output ) and
120+ output .isReturnValueDeref ( _) and
121+ node = callOutput ( call , output )
122122 )
123123 or
124- // Case 1 : It's a known dataflow or taintflow function with flow to an output parameter
125- exists ( Function func , int i , CallInstruction call |
124+ // Case 2 : It's a known dataflow or taintflow function with flow to an output parameter
125+ exists ( int i |
126126 call .getPositionalArgumentOperand ( i ) .getDef ( ) .getUnconvertedResultExpression ( ) =
127127 node .asDefiningArgument ( ) and
128- func = call .getStaticCallTarget ( ) and
129128 not exists ( FunctionOutput output |
130129 dataFlowOrTaintFlowFunction ( func , output ) and
131- output .isParameterDeref ( i ) and
130+ output .isParameterDeref ( i , _ ) and
132131 node = callOutput ( call , output )
133132 )
134133 )
135- ) and
136- not exists ( Call c |
137- c .getTarget ( ) .hasDefinition ( ) and
138- if node instanceof DataFlow:: DefinitionByReferenceNode
139- then c .getAnArgument ( ) = node .asDefiningArgument ( )
140- else c = node .asIndirectExpr ( )
141134 )
142135}
143136
0 commit comments