Skip to content

Commit 2b9417a

Browse files
committed
Address review
1 parent c6ff56c commit 2b9417a

2 files changed

Lines changed: 43 additions & 39 deletions

File tree

soot-infoflow-integration/test/soot/jimple/infoflow/integration/test/junit/OutputStreamTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ public void testFileWriter1() {
259259
this.checkInfoflow(infoflow, 1);
260260
}
261261

262-
@Test//(timeout = 30000)
262+
@Test(timeout = 30000)
263263
public void testCastWithSummaryTypeInformation1() {
264264
IInfoflow infoflow = this.initInfoflow();
265265
infoflow.setTaintPropagationHandler(new DebugFlowFunctionTaintPropagationHandler());

soot-infoflow-summaries/src/soot/jimple/infoflow/methodSummary/taintWrappers/SummaryTaintWrapper.java

Lines changed: 42 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -208,49 +208,53 @@ public void initialize(InfoflowManager manager) {
208208
fallbackWrapper.initialize(manager);
209209
}
210210

211-
public Collection<PreAnalysisHandler> getPreAnalysisHandlers() {
212-
return Collections.singleton(new PreAnalysisHandler() {
213-
@Override
214-
public void onBeforeCallgraphConstruction() {
215-
// Inject the hierarchy
216-
for (String className : flows.getAllClassesWithSummaries()) {
217-
SootClass sc = Scene.v().forceResolve(className, SootClass.SIGNATURES);
218-
if (sc.isPhantom()) {
219-
ClassMethodSummaries summaries = flows.getClassFlows(className);
220-
if (summaries != null) {
221-
// Some phantom classes are actually interfaces
222-
if (summaries.hasInterfaceInfo()) {
223-
if (summaries.isInterface())
224-
sc.setModifiers(sc.getModifiers() | Modifier.INTERFACE);
225-
else
226-
sc.setModifiers(sc.getModifiers() & ~Modifier.INTERFACE);
227-
}
228-
229-
// Set the correct superclass
230-
if (summaries.hasSuperclass()) {
231-
final String superclassName = summaries.getSuperClass();
232-
SootClass scSuperclass = Scene.v().forceResolve(superclassName, SootClass.SIGNATURES);
233-
sc.setSuperclass(scSuperclass);
234-
}
235-
236-
// Register the interfaces
237-
if (summaries.hasInterfaces()) {
238-
for (String intfName : summaries.getInterfaces()) {
239-
SootClass scIntf = Scene.v().forceResolve(intfName, SootClass.SIGNATURES);
240-
if (!sc.implementsInterface(intfName))
241-
sc.addInterface(scIntf);
242-
}
243-
}
244-
}
211+
class HierarchyInjector implements PreAnalysisHandler {
212+
@Override
213+
public void onBeforeCallgraphConstruction() {
214+
// Inject the hierarchy
215+
for (String className : flows.getAllClassesWithSummaries()) {
216+
SootClass sc = Scene.v().forceResolve(className, SootClass.SIGNATURES);
217+
if (!sc.isPhantom())
218+
return;
219+
220+
ClassMethodSummaries summaries = flows.getClassFlows(className);
221+
if (summaries == null)
222+
return;
223+
224+
// Some phantom classes are actually interfaces
225+
if (summaries.hasInterfaceInfo()) {
226+
if (summaries.isInterface())
227+
sc.setModifiers(sc.getModifiers() | Modifier.INTERFACE);
228+
else
229+
sc.setModifiers(sc.getModifiers() & ~Modifier.INTERFACE);
230+
}
231+
232+
// Set the correct superclass
233+
if (summaries.hasSuperclass()) {
234+
final String superclassName = summaries.getSuperClass();
235+
SootClass scSuperclass = Scene.v().forceResolve(superclassName, SootClass.SIGNATURES);
236+
sc.setSuperclass(scSuperclass);
237+
}
238+
239+
// Register the interfaces
240+
if (summaries.hasInterfaces()) {
241+
for (String intfName : summaries.getInterfaces()) {
242+
SootClass scIntf = Scene.v().forceResolve(intfName, SootClass.SIGNATURES);
243+
if (!sc.implementsInterface(intfName))
244+
sc.addInterface(scIntf);
245245
}
246246
}
247247
}
248+
}
248249

249-
@Override
250-
public void onAfterCallgraphConstruction() {
250+
@Override
251+
public void onAfterCallgraphConstruction() {
252+
// NO-OP
253+
}
254+
}
251255

252-
}
253-
});
256+
public Collection<PreAnalysisHandler> getPreAnalysisHandlers() {
257+
return Collections.singleton(new HierarchyInjector());
254258
}
255259

256260
/**

0 commit comments

Comments
 (0)