Skip to content

Commit 0d578a7

Browse files
committed
Removal of DBG code and bug-fixes in "read" and "write" functions.
1 parent cdcc087 commit 0d578a7

File tree

1 file changed

+10
-31
lines changed
  • benchmarks/TRAINING/diffblue/taint_traces_07

1 file changed

+10
-31
lines changed

benchmarks/TRAINING/diffblue/taint_traces_07/test.java

Lines changed: 10 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,5 @@
11
package training07;
22

3-
class BBB
4-
{
5-
int bbb;
6-
private byte[] s;
7-
public BBB() {
8-
bbb = 0;
9-
s = new byte[10];
10-
}
11-
}
12-
13-
class DDD extends BBB
14-
{
15-
int ddd;
16-
private byte[] ss = new byte[20];
17-
}
18-
19-
class XXX {
20-
public DDD ddd;
21-
};
22-
233
class String {
244
public String() {
255
this.bytes = new byte[1];
@@ -44,8 +24,11 @@ public InputStream(String init) {
4424
this.s = init.getBytes();
4525
}
4626
int read(byte[] data, int shift, int count) {
47-
for (int i = shift; i != count; ++i)
48-
data[i] = this.s[i];
27+
for (int i = 0; i != count; ++i) {
28+
if (i == this.s.length)
29+
return i;
30+
data[shift + i] = this.s[i];
31+
}
4932
return count;
5033
}
5134
private byte[] s;
@@ -65,8 +48,11 @@ public OutputStream() {
6548
this.s = new byte[100];
6649
}
6750
public void write(byte[] data, int shift, int count) {
68-
for (int i = 0; i != count; ++i)
51+
for (int i = 0; i != count; ++i) {
52+
if (i == this.s.length)
53+
return;
6954
this.s[i] = data[i];
55+
}
7056
}
7157
public void write(byte[] data) {
7258
write(data,0,data.length);
@@ -117,12 +103,11 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) {
117103
int size = getBytes(data,in);
118104
String str0 = new String(data, 0, size);
119105
String str = str0;
120-
//str = sanitise(str);
106+
str = sanitise(str);
121107
OutputStream out0 = getOutStream(response);
122108
OutputStream out = out0;
123109
out.write(data,0,size);
124110
out.write(str.getBytes());
125-
foo();
126111
}
127112

128113
private InputStream getInStream(HttpServletRequest request) {
@@ -143,11 +128,5 @@ private String sanitise(String str) {
143128
private OutputStream getOutStream(HttpServletResponse response) {
144129
return response.getOutputStream();
145130
}
146-
147-
public void foo() {
148-
XXX xxx = new XXX();
149-
xxx.ddd = new DDD();
150-
}
151131
}
152132

153-

0 commit comments

Comments
 (0)