@@ -38,8 +38,7 @@ private class StdBasicStringIterator extends Iterator, Type {
3838 */
3939abstract private class StdStringTaintFunction extends TaintFunction {
4040 /**
41- * Gets the index of a parameter to this function that is a string (or
42- * character).
41+ * Gets the index of a parameter to this function that is a string.
4342 */
4443 final int getAStringParameterIndex ( ) {
4544 exists ( Type paramType | paramType = this .getParameter ( result ) .getUnspecifiedType ( ) |
@@ -50,7 +49,14 @@ abstract private class StdStringTaintFunction extends TaintFunction {
5049 paramType instanceof ReferenceType and
5150 not paramType .( ReferenceType ) .getBaseType ( ) =
5251 this .getDeclaringType ( ) .getTemplateArgument ( 2 ) .( Type ) .getUnspecifiedType ( )
53- or
52+ )
53+ }
54+
55+ /**
56+ * Gets the index of a parameter to this function that is a character.
57+ */
58+ final int getACharParameterIndex ( ) {
59+ exists ( Type paramType | paramType = this .getParameter ( result ) .getUnspecifiedType ( ) |
5460 // i.e. `std::basic_string::CharT`
5561 paramType = this .getDeclaringType ( ) .getTemplateArgument ( 0 ) .( Type ) .getUnspecifiedType ( )
5662 )
@@ -79,6 +85,7 @@ private class StdStringConstructor extends Constructor, StdStringTaintFunction {
7985 // taint flow from any parameter of the value type to the returned object
8086 (
8187 input .isParameterDeref ( this .getAStringParameterIndex ( ) ) or
88+ input .isParameter ( this .getACharParameterIndex ( ) ) or
8289 input .isParameter ( this .getAnIteratorParameterIndex ( ) )
8390 ) and
8491 (
@@ -128,7 +135,7 @@ private class StdStringPush extends StdStringTaintFunction {
128135
129136 override predicate hasTaintFlow ( FunctionInput input , FunctionOutput output ) {
130137 // flow from parameter to qualifier
131- input .isParameterDeref ( 0 ) and
138+ input .isParameter ( 0 ) and
132139 output .isQualifierObject ( )
133140 }
134141}
@@ -180,6 +187,7 @@ private class StdStringAppend extends StdStringTaintFunction {
180187 (
181188 input .isQualifierObject ( ) or
182189 input .isParameterDeref ( this .getAStringParameterIndex ( ) ) or
190+ input .isParameter ( this .getACharParameterIndex ( ) ) or
183191 input .isParameter ( this .getAnIteratorParameterIndex ( ) )
184192 ) and
185193 (
@@ -210,6 +218,7 @@ private class StdStringInsert extends StdStringTaintFunction {
210218 (
211219 input .isQualifierObject ( ) or
212220 input .isParameterDeref ( this .getAStringParameterIndex ( ) ) or
221+ input .isParameter ( this .getACharParameterIndex ( ) ) or
213222 input .isParameter ( this .getAnIteratorParameterIndex ( ) )
214223 ) and
215224 (
@@ -236,6 +245,7 @@ private class StdStringAssign extends StdStringTaintFunction {
236245 // flow from parameter to string itself (qualifier) and return value
237246 (
238247 input .isParameterDeref ( this .getAStringParameterIndex ( ) ) or
248+ input .isParameter ( this .getACharParameterIndex ( ) ) or
239249 input .isParameter ( this .getAnIteratorParameterIndex ( ) )
240250 ) and
241251 (
0 commit comments