Skip to content

Commit 8ee726a

Browse files
committed
Properly reset the executor. If during batch path processing, the last batch failed due to OOM, do not try another batch because the abstractions still have the paths from the previous batch, i.e., the memory is still consumed, and trying another batch will just result in another OOM
1 parent 96ff6e7 commit 8ee726a

12 files changed

Lines changed: 280 additions & 175 deletions

File tree

soot-infoflow-android/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@
172172
<dependency>
173173
<groupId>commons-io</groupId>
174174
<artifactId>commons-io</artifactId>
175-
<version>2.18.0</version>
175+
<version>2.21.0</version>
176176
</dependency>
177177
</dependencies>
178178
</project>

soot-infoflow-integration/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
<dependency>
133133
<groupId>org.json</groupId>
134134
<artifactId>json</artifactId>
135-
<version>20240303</version>
135+
<version>20251224</version>
136136
<scope>test</scope>
137137
</dependency>
138138
<dependency>
@@ -144,7 +144,7 @@
144144
<dependency>
145145
<groupId>org.springframework</groupId>
146146
<artifactId>spring-web</artifactId>
147-
<version>6.2.8</version>
147+
<version>7.0.2</version>
148148
<scope>test</scope>
149149
</dependency>
150150
</dependencies>

soot-infoflow-integration/res/RiverSourcesAndSinks.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
</param>
2727
<additionalFlowCondition>
2828
<signatureOnPath signature="java.net.URL: java.net.URLConnection openConnection()" />
29+
<signatureOnPath signature="soot.jimple.infoflow.integration.test.RiverTestCode: java.lang.String getExternalCacheDir()" />
2930
</additionalFlowCondition>
3031
</method>
3132
<method signature="java.io.OutputStream: void write(int)">
Lines changed: 188 additions & 162 deletions
Original file line numberDiff line numberDiff line change
@@ -1,172 +1,198 @@
11
package soot.jimple.infoflow.integration.test;
22

3-
import java.io.*;
3+
import java.io.BufferedOutputStream;
4+
import java.io.BufferedWriter;
5+
import java.io.ByteArrayOutputStream;
6+
import java.io.FileInputStream;
7+
import java.io.FileOutputStream;
8+
import java.io.IOException;
9+
import java.io.OutputStream;
10+
import java.io.OutputStreamWriter;
411
import java.net.URL;
512
import java.net.URLConnection;
613

714
public class RiverTestCode {
8-
public static String source() {
9-
return "secret";
10-
}
11-
public static int intSource() {
12-
return 1337;
13-
}
15+
public static String source() {
16+
return "secret";
17+
}
1418

15-
public void riverTest1() {
16-
try {
17-
String src = source();
19+
public static int intSource() {
20+
return 1337;
21+
}
1822

19-
URL url = new URL("http://some.url");
20-
URLConnection con = url.openConnection();
21-
22-
OutputStream os = con.getOutputStream();
23-
24-
OutputStream osb = new BufferedOutputStream(os);
25-
osb.write(src.getBytes());
26-
} catch (IOException e) {
27-
throw new RuntimeException(e);
28-
}
29-
}
30-
31-
public void riverTest2() {
32-
try {
33-
String src = source();
34-
35-
OutputStream os = new ByteArrayOutputStream();
36-
37-
OutputStream osb = new BufferedOutputStream(os);
38-
osb.write(src.getBytes());
39-
} catch (IOException e) {
40-
throw new RuntimeException(e);
41-
}
42-
}
43-
44-
public void riverTest3() {
45-
try {
46-
String src = source();
47-
48-
URL url = new URL("http://some.url");
49-
URLConnection con = url.openConnection();
50-
51-
OutputStream os = con.getOutputStream();
52-
53-
BufferedOutputStream osb = new BufferedOutputStream(os);
54-
osb.write(src.getBytes());
55-
} catch (IOException e) {
56-
throw new RuntimeException(e);
57-
}
58-
}
59-
60-
public void riverTest4() {
61-
try {
62-
String src = source();
63-
64-
ByteArrayOutputStream os = new ByteArrayOutputStream();
65-
66-
BufferedOutputStream osb = new BufferedOutputStream(os);
67-
osb.write(src.getBytes());
68-
} catch (IOException e) {
69-
throw new RuntimeException(e);
70-
}
71-
}
72-
73-
public void riverTest5() {
74-
try {
75-
String src = source();
76-
77-
URL url = new URL("http://some.url");
78-
URLConnection con = url.openConnection();
79-
80-
OutputStream os = con.getOutputStream();
81-
82-
new BufferedWriter(new OutputStreamWriter(os)).write(src);
83-
} catch (IOException e) {
84-
throw new RuntimeException(e);
85-
}
86-
}
87-
88-
public void riverTest6() {
89-
try {
90-
String src = source();
91-
92-
OutputStream os = new ByteArrayOutputStream();
93-
94-
new BufferedWriter(new OutputStreamWriter(os)).write(src);
95-
} catch (IOException e) {
96-
throw new RuntimeException(e);
97-
}
98-
}
99-
100-
public void riverTest7() {
101-
try {
102-
String src1 = source();
103-
String src2 = source();
104-
105-
URL url = new URL("http://some.url");
106-
URLConnection con = url.openConnection();
107-
108-
OutputStream os1 = con.getOutputStream();
109-
OutputStream os2 = new ByteArrayOutputStream();
110-
111-
OutputStream os1b = new BufferedOutputStream(os1);
112-
OutputStream os2b = new BufferedOutputStream(os2);
113-
114-
os1b.write(src1.getBytes());
115-
os2.write(src2.getBytes());
116-
117-
new BufferedWriter(new OutputStreamWriter(os1b)).write(src1);
118-
new BufferedWriter(new OutputStreamWriter(os2b)).write(src2);
119-
} catch (IOException e) {
120-
throw new RuntimeException(e);
121-
}
122-
}
123-
124-
void sendToUrl(URL url, String data) {
125-
System.out.println("leak");
126-
}
127-
128-
public void riverTest8() {
129-
try {
130-
URL url = new URL("http://some.url");
131-
132-
String source = source();
133-
sendToUrl(url, source);
134-
} catch (IOException e) {
135-
throw new RuntimeException(e);
136-
}
137-
}
138-
139-
void unconditionalSink(String str) {
140-
System.out.println("leak");
141-
}
142-
143-
public void riverTest9() {
144-
unconditionalSink(source());
145-
}
146-
147-
148-
void classConditionalSink(String data) {
149-
System.out.println("leak");
150-
}
151-
152-
static class T {
153-
void injectSensitiveData(OutputStream os) {
154-
//
155-
}
156-
}
157-
158-
public void riverTest10() throws IOException {
159-
int secret = intSource();
160-
OutputStream os = new ByteArrayOutputStream();
161-
os.write(secret);
162-
}
163-
164-
public void riverTest11() throws IOException {
165-
int secret = intSource();
166-
OutputStream os = new ByteArrayOutputStream();
167-
T t = new T();
168-
t.injectSensitiveData(os);
169-
os.write(secret);
170-
}
23+
public void riverTest1() {
24+
try {
25+
String src = source();
26+
27+
URL url = new URL("http://some.url");
28+
URLConnection con = url.openConnection();
29+
30+
OutputStream os = con.getOutputStream();
31+
32+
OutputStream osb = new BufferedOutputStream(os);
33+
osb.write(src.getBytes());
34+
} catch (IOException e) {
35+
throw new RuntimeException(e);
36+
}
37+
}
38+
39+
public void riverTest2() {
40+
try {
41+
String src = source();
42+
43+
OutputStream os = new ByteArrayOutputStream();
44+
45+
OutputStream osb = new BufferedOutputStream(os);
46+
osb.write(src.getBytes());
47+
} catch (IOException e) {
48+
throw new RuntimeException(e);
49+
}
50+
}
51+
52+
public void riverTest3() {
53+
try {
54+
String src = source();
55+
56+
URL url = new URL("http://some.url");
57+
URLConnection con = url.openConnection();
58+
59+
OutputStream os = con.getOutputStream();
60+
61+
BufferedOutputStream osb = new BufferedOutputStream(os);
62+
osb.write(src.getBytes());
63+
} catch (IOException e) {
64+
throw new RuntimeException(e);
65+
}
66+
}
67+
68+
public void riverTest4() {
69+
try {
70+
String src = source();
71+
72+
ByteArrayOutputStream os = new ByteArrayOutputStream();
73+
74+
BufferedOutputStream osb = new BufferedOutputStream(os);
75+
osb.write(src.getBytes());
76+
} catch (IOException e) {
77+
throw new RuntimeException(e);
78+
}
79+
}
80+
81+
public void riverTest5() {
82+
try {
83+
String src = source();
84+
85+
URL url = new URL("http://some.url");
86+
URLConnection con = url.openConnection();
87+
88+
OutputStream os = con.getOutputStream();
89+
90+
new BufferedWriter(new OutputStreamWriter(os)).write(src);
91+
} catch (IOException e) {
92+
throw new RuntimeException(e);
93+
}
94+
}
95+
96+
public void riverTest6() {
97+
try {
98+
String src = source();
99+
100+
OutputStream os = new ByteArrayOutputStream();
101+
102+
new BufferedWriter(new OutputStreamWriter(os)).write(src);
103+
} catch (IOException e) {
104+
throw new RuntimeException(e);
105+
}
106+
}
107+
108+
public void riverTest7() {
109+
try {
110+
String src1 = source();
111+
String src2 = source();
112+
113+
URL url = new URL("http://some.url");
114+
URLConnection con = url.openConnection();
115+
116+
OutputStream os1 = con.getOutputStream();
117+
OutputStream os2 = new ByteArrayOutputStream();
118+
119+
OutputStream os1b = new BufferedOutputStream(os1);
120+
OutputStream os2b = new BufferedOutputStream(os2);
121+
122+
os1b.write(src1.getBytes());
123+
os2.write(src2.getBytes());
124+
125+
new BufferedWriter(new OutputStreamWriter(os1b)).write(src1);
126+
new BufferedWriter(new OutputStreamWriter(os2b)).write(src2);
127+
} catch (IOException e) {
128+
throw new RuntimeException(e);
129+
}
130+
}
131+
132+
void sendToUrl(URL url, String data) {
133+
System.out.println("leak");
134+
}
135+
136+
public void riverTest8() {
137+
try {
138+
URL url = new URL("http://some.url");
139+
140+
String source = source();
141+
sendToUrl(url, source);
142+
} catch (IOException e) {
143+
throw new RuntimeException(e);
144+
}
145+
}
146+
147+
void unconditionalSink(String str) {
148+
System.out.println("leak");
149+
}
150+
151+
public void riverTest9() {
152+
unconditionalSink(source());
153+
}
154+
155+
void classConditionalSink(String data) {
156+
System.out.println("leak");
157+
}
158+
159+
static class T {
160+
void injectSensitiveData(OutputStream os) {
161+
//
162+
}
163+
}
164+
165+
public void riverTest10() throws IOException {
166+
int secret = intSource();
167+
OutputStream os = new ByteArrayOutputStream();
168+
os.write(secret);
169+
}
170+
171+
public void riverTest11() throws IOException {
172+
int secret = intSource();
173+
OutputStream os = new ByteArrayOutputStream();
174+
T t = new T();
175+
t.injectSensitiveData(os);
176+
os.write(secret);
177+
}
178+
179+
public String getExternalCacheDir() {
180+
return String.valueOf(Math.random());
181+
}
182+
183+
public void riverTest12() throws IOException {
184+
String path = getExternalCacheDir();
185+
OutputStream os = new FileOutputStream(path);
186+
os.write(source().getBytes());
187+
}
188+
189+
public void pseudoInfluenceTest1() throws IOException {
190+
byte[] data = new byte[512];
191+
String path = getExternalCacheDir();
192+
new FileInputStream(path).read(data);
193+
var os = new ByteArrayOutputStream();
194+
os.write(data);
195+
os.write(source().getBytes());
196+
}
171197

172198
}

0 commit comments

Comments
 (0)