@@ -109,35 +109,28 @@ predicate isNonConst(DataFlow::Node node) {
109
109
// i.e., functions that with unknown bodies and are not known to define the output through its input
110
110
// are considered as possible non-const sources
111
111
// 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
+ |
113
116
// 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 )
122
122
)
123
123
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 |
126
126
call .getPositionalArgumentOperand ( i ) .getDef ( ) .getUnconvertedResultExpression ( ) =
127
127
node .asDefiningArgument ( ) and
128
- func = call .getStaticCallTarget ( ) and
129
128
not exists ( FunctionOutput output |
130
129
dataFlowOrTaintFlowFunction ( func , output ) and
131
- output .isParameterDeref ( i ) and
130
+ output .isParameterDeref ( i , _ ) and
132
131
node = callOutput ( call , output )
133
132
)
134
133
)
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 ( )
141
134
)
142
135
}
143
136
0 commit comments