File tree Expand file tree Collapse file tree 2 files changed +21
-3
lines changed
test/library-tests/dataflow/stream-read Expand file tree Collapse file tree 2 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -232,10 +232,10 @@ private class InputStreamWrapperAnonymousStep extends AdditionalTaintStep {
232232 */
233233private class InputStreamWrapperConstructorStep extends AdditionalTaintStep {
234234 override predicate step ( DataFlow:: Node n1 , DataFlow:: Node n2 ) {
235- exists ( ClassInstanceExpr cc , Argument a , AssignExpr ae |
235+ exists ( ClassInstanceExpr cc , Argument a , AssignExpr ae , int pos |
236236 cc .getConstructedType ( ) .getASourceSupertype + ( ) instanceof TypeInputStream and
237- cc .getAnArgument ( ) = a and
238- cc .getCallee ( ) .getParameter ( a . getParameterPos ( ) ) .getAnAccess ( ) = ae .getRhs ( ) and
237+ cc .getArgument ( pragma [ only_bind_into ] ( pos ) ) = a and
238+ cc .getCallee ( ) .getParameter ( pragma [ only_bind_into ] ( pos ) ) .getAnAccess ( ) = ae .getRhs ( ) and
239239 ae .getDest ( ) .( FieldWrite ) .getField ( ) .getType ( ) .( RefType ) .getASourceSupertype * ( ) instanceof
240240 TypeInputStream
241241 |
Original file line number Diff line number Diff line change @@ -84,4 +84,22 @@ public int read(byte[] b) throws IOException {
8484 sink (wrapper ); // $ hasTaintFlow
8585 }
8686
87+ public static InputStream wrapStream (InputStream in ) {
88+ return new InputStream () {
89+ @ Override
90+ public int read () throws IOException {
91+ return 0 ;
92+ }
93+
94+ @ Override
95+ public int read (byte [] b ) throws IOException {
96+ return in .read (b );
97+ }
98+ };
99+ }
100+
101+ public static void testWrapCall () {
102+ sink (wrapStream (null )); // no flow
103+ sink (wrapStream (source ())); // $ hasTaintFlow
104+ }
87105}
You can’t perform that action at this time.
0 commit comments