-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Copy pathTest.java
55 lines (40 loc) · 1.62 KB
/
Test.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package com.mycompany.app;
import org.apache.commons.fileupload.util.Streams;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.ByteArrayOutputStream;
// Test case generated by GenerateFlowTestCase.ql
public class Test {
Object source() {
return null;
}
void sink(Object o) {
}
public void test() throws Exception {
{
InputStream in = (InputStream)source();
OutputStream os = new ByteArrayOutputStream(1024);
InputStream in2 = (InputStream)source();
OutputStream os2 = new ByteArrayOutputStream(1024);
byte[] myArray = new byte[1024];
// "org.apache.commons.fileupload.util;Streams;true;copy;(InputStream,OutputStream,boolean,byte[]);;Argument[0];Argument[1];taint;manual"
long status = Streams.copy(in, os, true, myArray);
sink(os); // $ hasTaintFlow
// "org.apache.commons.fileupload.util;Streams;true;copy;(InputStream,OutputStream,boolean);;Argument[0];Argument[1];taint;manual"
long status2 = Streams.copy(in2, os2, true);
sink(os2); // $ hasTaintFlow
}
}
public void test2() throws Exception {
{
InputStream in = (InputStream)source();
// "org.apache.commons.fileupload.util;Streams;true;asString;(InputStream,String);;Argument[0];ReturnValue;taint;manual"
String result = Streams.asString(in);
sink(result); // $ hasTaintFlow
InputStream in1 = (InputStream)source();
// "org.apache.commons.fileupload.util;Streams;true;asString;(InputStream,String);;Argument[0];ReturnValue;taint;manual"
String result1 = Streams.asString(in1, "test");
sink(result1); // $ hasTaintFlow
}
}
}