@@ -403,6 +403,39 @@ class StdIStreamReadSome extends TaintFunction {
403403 }
404404}
405405
406+ /**
407+ * The `std::istream` function `putback`.
408+ */
409+ class StdIStreamPutBack extends DataFlowFunction , TaintFunction {
410+ StdIStreamPutBack ( ) { this .hasQualifiedName ( "std" , "basic_istream" , "putback" ) }
411+
412+ override predicate hasDataFlow ( FunctionInput input , FunctionOutput output ) {
413+ // flow from qualifier to return value
414+ input .isQualifierAddress ( ) and
415+ output .isReturnValue ( )
416+ }
417+
418+ override predicate hasTaintFlow ( FunctionInput input , FunctionOutput output ) {
419+ // flow from first parameter (value or pointer) to qualifier
420+ input .isParameter ( 0 ) and
421+ output .isQualifierObject ( )
422+ or
423+ input .isParameterDeref ( 0 ) and
424+ output .isQualifierObject ( )
425+ or
426+ // flow from first parameter (value or pointer) to return value
427+ input .isParameter ( 0 ) and
428+ output .isReturnValueDeref ( )
429+ or
430+ input .isParameterDeref ( 0 ) and
431+ output .isReturnValueDeref ( )
432+ or
433+ // reverse flow from returned reference to the qualifier
434+ input .isReturnValueDeref ( ) and
435+ output .isQualifierObject ( )
436+ }
437+ }
438+
406439/**
407440 * The `std::basic_ostream` template class.
408441 */
@@ -412,13 +445,10 @@ class StdBasicOStream extends TemplateClass {
412445
413446/**
414447 * The `std::ostream` functions `operator<<` (defined as a member function),
415- * `put` and `write` and `std::istream::putback` .
448+ * `put` and `write`.
416449 */
417450class StdOStreamOut extends DataFlowFunction , TaintFunction {
418- StdOStreamOut ( ) {
419- this .hasQualifiedName ( "std" , "basic_ostream" , [ "operator<<" , "put" , "write" ] ) or
420- this .hasQualifiedName ( "std" , "basic_istream" , "putback" )
421- }
451+ StdOStreamOut ( ) { this .hasQualifiedName ( "std" , "basic_ostream" , [ "operator<<" , "put" , "write" ] ) }
422452
423453 override predicate hasDataFlow ( FunctionInput input , FunctionOutput output ) {
424454 // flow from qualifier to return value
0 commit comments