@@ -131,16 +131,23 @@ private class IteratorPointerDereferenceOperator extends Operator, TaintFunction
131131/**
132132 * A non-member `operator++` or `operator--` function for an iterator type.
133133 */
134- private class IteratorCrementOperator extends Operator , DataFlowFunction {
134+ class IteratorCrementOperator extends Operator {
135135 FunctionInput iteratorInput ;
136136
137137 IteratorCrementOperator ( ) {
138138 this .hasName ( [ "operator++" , "operator--" ] ) and
139139 iteratorInput = getIteratorArgumentInput ( this , 0 )
140140 }
141141
142+ /**
143+ * INTERNAL: Do not use.
144+ */
145+ FunctionInput getIteratorInput ( ) { result = iteratorInput }
146+ }
147+
148+ private class IteratorCrementOperatorModel extends IteratorCrementOperator , DataFlowFunction {
142149 override predicate hasDataFlow ( FunctionInput input , FunctionOutput output ) {
143- input = iteratorInput and
150+ input = this . getIteratorInput ( ) and
144151 output .isReturnValue ( )
145152 or
146153 input .isParameterDeref ( 0 ) and output .isReturnValueDeref ( )
@@ -150,24 +157,28 @@ private class IteratorCrementOperator extends Operator, DataFlowFunction {
150157/**
151158 * A non-member `operator+` function for an iterator type.
152159 */
153- private class IteratorAddOperator extends Operator , TaintFunction {
160+ class IteratorAddOperator extends Operator {
154161 FunctionInput iteratorInput ;
155162
156163 IteratorAddOperator ( ) {
157164 this .hasName ( "operator+" ) and
158165 iteratorInput = getIteratorArgumentInput ( this , [ 0 , 1 ] )
159166 }
160167
168+ FunctionInput getIteratorInput ( ) { result = iteratorInput }
169+ }
170+
171+ private class IteratorAddOperatorModel extends IteratorAddOperator , TaintFunction {
161172 override predicate hasTaintFlow ( FunctionInput input , FunctionOutput output ) {
162- input = iteratorInput and
173+ input = this . getIteratorInput ( ) and
163174 output .isReturnValue ( )
164175 }
165176}
166177
167178/**
168179 * A non-member `operator-` function that takes a pointer difference type as its second argument.
169180 */
170- private class IteratorSubOperator extends Operator , TaintFunction {
181+ class IteratorSubOperator extends Operator {
171182 FunctionInput iteratorInput ;
172183
173184 IteratorSubOperator ( ) {
@@ -176,8 +187,12 @@ private class IteratorSubOperator extends Operator, TaintFunction {
176187 this .getParameter ( 1 ) .getUnspecifiedType ( ) instanceof IntegralType // not an iterator difference
177188 }
178189
190+ FunctionInput getIteratorInput ( ) { result = iteratorInput }
191+ }
192+
193+ private class IteratorSubOperatorModel extends IteratorSubOperator , TaintFunction {
179194 override predicate hasTaintFlow ( FunctionInput input , FunctionOutput output ) {
180- input = iteratorInput and
195+ input = this . getIteratorInput ( ) and
181196 output .isReturnValue ( )
182197 }
183198}
@@ -272,11 +287,14 @@ private class IteratorFieldMemberOperator extends Operator, TaintFunction {
272287/**
273288 * An `operator+` or `operator-` member function of an iterator class.
274289 */
275- private class IteratorBinaryArithmeticMemberOperator extends MemberFunction , TaintFunction {
290+ class IteratorBinaryArithmeticMemberOperator extends MemberFunction {
276291 IteratorBinaryArithmeticMemberOperator ( ) {
277292 this .getClassAndName ( [ "operator+" , "operator-" ] ) instanceof Iterator
278293 }
294+ }
279295
296+ private class IteratorBinaryArithmeticMemberOperatorModel extends IteratorBinaryArithmeticMemberOperator ,
297+ TaintFunction {
280298 override predicate hasTaintFlow ( FunctionInput input , FunctionOutput output ) {
281299 input .isQualifierObject ( ) and
282300 output .isReturnValue ( )
@@ -286,12 +304,14 @@ private class IteratorBinaryArithmeticMemberOperator extends MemberFunction, Tai
286304/**
287305 * An `operator+=` or `operator-=` member function of an iterator class.
288306 */
289- private class IteratorAssignArithmeticMemberOperator extends MemberFunction , DataFlowFunction ,
290- TaintFunction {
307+ class IteratorAssignArithmeticMemberOperator extends MemberFunction {
291308 IteratorAssignArithmeticMemberOperator ( ) {
292309 this .getClassAndName ( [ "operator+=" , "operator-=" ] ) instanceof Iterator
293310 }
311+ }
294312
313+ private class IteratorAssignArithmeticMemberOperatorModel extends IteratorAssignArithmeticMemberOperator ,
314+ DataFlowFunction , TaintFunction {
295315 override predicate hasDataFlow ( FunctionInput input , FunctionOutput output ) {
296316 input .isQualifierAddress ( ) and
297317 output .isReturnValue ( )
@@ -326,17 +346,24 @@ private class IteratorArrayMemberOperator extends MemberFunction, TaintFunction,
326346/**
327347 * An `operator=` member function of an iterator class that is not a copy or move assignment
328348 * operator.
329- *
330- * The `hasTaintFlow` override provides flow through output iterators that return themselves with
331- * `operator*` and use their own `operator=` to assign to the container.
332349 */
333- private class IteratorAssignmentMemberOperator extends MemberFunction , TaintFunction {
350+ class IteratorAssignmentMemberOperator extends MemberFunction {
334351 IteratorAssignmentMemberOperator ( ) {
335352 this .getClassAndName ( "operator=" ) instanceof Iterator and
336353 not this instanceof CopyAssignmentOperator and
337354 not this instanceof MoveAssignmentOperator
338355 }
356+ }
339357
358+ /**
359+ * An `operator=` member function of an iterator class that is not a copy or move assignment
360+ * operator.
361+ *
362+ * The `hasTaintFlow` override provides flow through output iterators that return themselves with
363+ * `operator*` and use their own `operator=` to assign to the container.
364+ */
365+ private class IteratorAssignmentMemberOperatorModel extends IteratorAssignmentMemberOperator ,
366+ TaintFunction {
340367 override predicate hasTaintFlow ( FunctionInput input , FunctionOutput output ) {
341368 input .isParameterDeref ( 0 ) and
342369 output .isQualifierObject ( )
0 commit comments