@@ -167,11 +167,15 @@ private class IteratorAssignArithmeticOperator extends Operator, DataFlowFunctio
167
167
override predicate hasDataFlow ( FunctionInput input , FunctionOutput output ) {
168
168
input .isParameter ( 0 ) and
169
169
output .isReturnValue ( )
170
- or
171
- input .isParameterDeref ( 0 ) and output .isReturnValueDeref ( )
172
170
}
173
171
174
172
override predicate hasTaintFlow ( FunctionInput input , FunctionOutput output ) {
173
+ input .isParameterDeref ( 0 ) and output .isReturnValueDeref ( )
174
+ or
175
+ // reverse flow from returned reference to the object referenced by the first parameter
176
+ input .isReturnValueDeref ( ) and
177
+ output .isParameterDeref ( 0 )
178
+ or
175
179
input .isParameterDeref ( 1 ) and
176
180
output .isParameterDeref ( 0 )
177
181
}
@@ -224,9 +228,7 @@ private class IteratorCrementMemberOperator extends MemberFunction, DataFlowFunc
224
228
* A member `operator->` function for an iterator type.
225
229
*/
226
230
private class IteratorFieldMemberOperator extends Operator , TaintFunction {
227
- IteratorFieldMemberOperator ( ) {
228
- this .getClassAndName ( "operator->" ) instanceof Iterator
229
- }
231
+ IteratorFieldMemberOperator ( ) { this .getClassAndName ( "operator->" ) instanceof Iterator }
230
232
231
233
override predicate hasTaintFlow ( FunctionInput input , FunctionOutput output ) {
232
234
input .isQualifierObject ( ) and
@@ -260,14 +262,18 @@ private class IteratorAssignArithmeticMemberOperator extends MemberFunction, Dat
260
262
override predicate hasDataFlow ( FunctionInput input , FunctionOutput output ) {
261
263
input .isQualifierAddress ( ) and
262
264
output .isReturnValue ( )
263
- or
264
- input .isReturnValueDeref ( ) and
265
- output .isQualifierObject ( )
266
265
}
267
266
268
267
override predicate hasTaintFlow ( FunctionInput input , FunctionOutput output ) {
269
268
input .isQualifierObject ( ) and
270
269
output .isReturnValueDeref ( )
270
+ or
271
+ // reverse flow from returned reference to the qualifier
272
+ input .isReturnValueDeref ( ) and
273
+ output .isQualifierObject ( )
274
+ or
275
+ input .isParameterDeref ( 0 ) and
276
+ output .isQualifierObject ( )
271
277
}
272
278
}
273
279
@@ -276,9 +282,7 @@ private class IteratorAssignArithmeticMemberOperator extends MemberFunction, Dat
276
282
*/
277
283
private class IteratorArrayMemberOperator extends MemberFunction , TaintFunction ,
278
284
IteratorReferenceFunction {
279
- IteratorArrayMemberOperator ( ) {
280
- this .getClassAndName ( "operator[]" ) instanceof Iterator
281
- }
285
+ IteratorArrayMemberOperator ( ) { this .getClassAndName ( "operator[]" ) instanceof Iterator }
282
286
283
287
override predicate hasTaintFlow ( FunctionInput input , FunctionOutput output ) {
284
288
input .isQualifierObject ( ) and
0 commit comments