Skip to content

Commit

Permalink
Summaries not rewritten, more taint locations added to report
Browse files Browse the repository at this point in the history
  • Loading branch information
formanek committed Oct 9, 2015
1 parent d5bb68d commit b368ec4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,16 @@ private void checkTaintSink(ConstantPoolGen cpg, InvokeInstruction invoke, Taint
if (finalTaint == null) {
continue;
}
if (finalTaint.isTainted()) {
if (finalTaint.isTainted() || finalTaint.hasParameters()) {
BugInstance bugInstance = sink.getBugInstance();
bugInstance.setPriority(Priorities.HIGH_PRIORITY);
bugInstance.addSourceLine(sourceLine);
} else if (finalTaint.hasParameters()) {
assert finalTaint.isUnknown();
BugInstance bugInstance = sink.getBugInstance();
bugInstance.addSourceLine(sourceLine);
delayBugToReport(currentMethod, finalTaint, bugInstance);
addSourceLines(finalTaint.getLocations(), bugInstance);
if (finalTaint.isTainted()) {
bugInstance.setPriority(Priorities.HIGH_PRIORITY);
} else {
assert finalTaint.isUnknown();
delayBugToReport(currentMethod, finalTaint, bugInstance);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ public void meetInto(TaintFrame fact, Edge edge, TaintFrame result)
mergeInto(fact, result);
}

/**
* This method must be called after executing the data flow
*/
public void finishAnalysis() {
visitor.finishAnalysis();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,9 @@ public void visitARETURN(ARETURN obj) {
handleNormalInstruction(obj);
}

/**
* This method must be called from outside at the end of the method analysis
*/
public void finishAnalysis() {
assert analyzedMethodSummary != null;
Taint outputTaint = analyzedMethodSummary.getOutputTaint();
Expand All @@ -501,7 +504,11 @@ public void finishAnalysis() {
String methodId = "." + methodDescriptor.getName() + methodDescriptor.getSignature();
if (analyzedMethodSummary.isInformative()
|| getSuperMethodSummary(className, methodId) != null) {
methodSummaries.put(className.concat(methodId), analyzedMethodSummary);
String fullMethodName = className.concat(methodId);
if (!methodSummaries.containsKey(fullMethodName)) {
// prefer configured summaries to derived
methodSummaries.put(fullMethodName, analyzedMethodSummary);
}
}
}
}

0 comments on commit b368ec4

Please sign in to comment.