@@ -298,9 +298,15 @@ class StdBasicOStream extends TemplateClass {
298298/**
299299 * The `std::ostream` function `operator<<` (defined as a member function).
300300 */
301- class StdOStreamOut extends TaintFunction {
301+ class StdOStreamOut extends DataFlowFunction , TaintFunction {
302302 StdOStreamOut ( ) { this .hasQualifiedName ( "std" , "basic_ostream" , "operator<<" ) }
303303
304+ override predicate hasDataFlow ( FunctionInput input , FunctionOutput output ) {
305+ // flow from qualifier to return value
306+ input .isQualifierObject ( ) and
307+ output .isReturnValueDeref ( )
308+ }
309+
304310 override predicate hasTaintFlow ( FunctionInput input , FunctionOutput output ) {
305311 // flow from parameter to qualifier
306312 input .isParameter ( 0 ) and
@@ -310,10 +316,6 @@ class StdOStreamOut extends TaintFunction {
310316 input .isParameter ( 0 ) and
311317 output .isReturnValueDeref ( )
312318 or
313- // flow from qualifier to return value
314- input .isQualifierObject ( ) and
315- output .isReturnValueDeref ( )
316- or
317319 // reverse flow from returned reference to the qualifier
318320 input .isReturnValueDeref ( ) and
319321 output .isQualifierObject ( )
@@ -323,13 +325,19 @@ class StdOStreamOut extends TaintFunction {
323325/**
324326 * The `std::ostream` function `operator<<` (defined as a non-member function).
325327 */
326- class StdOStreamOutNonMember extends TaintFunction {
328+ class StdOStreamOutNonMember extends DataFlowFunction , TaintFunction {
327329 StdOStreamOutNonMember ( ) {
328330 this .hasQualifiedName ( "std" , "operator<<" ) and
329331 this .getUnspecifiedType ( ) .( ReferenceType ) .getBaseType ( ) =
330332 any ( StdBasicOStream s ) .getAnInstantiation ( )
331333 }
332334
335+ override predicate hasDataFlow ( FunctionInput input , FunctionOutput output ) {
336+ // flow from first parameter to return value
337+ input .isParameter ( 0 ) and
338+ output .isReturnValueDeref ( )
339+ }
340+
333341 override predicate hasTaintFlow ( FunctionInput input , FunctionOutput output ) {
334342 // flow from second parameter to first parameter
335343 input .isParameter ( 1 ) and
@@ -339,10 +347,6 @@ class StdOStreamOutNonMember extends TaintFunction {
339347 input .isParameter ( 1 ) and
340348 output .isReturnValueDeref ( )
341349 or
342- // flow from first parameter to return value
343- input .isParameter ( 0 ) and
344- output .isReturnValueDeref ( )
345- or
346350 // reverse flow from returned reference to the first parameter
347351 input .isReturnValueDeref ( ) and
348352 output .isParameterDeref ( 0 )
0 commit comments