private void transferTaintToMutables(TaintMethodSummary methodSummary, Taint taint)
     throws RuntimeException {
   if (methodSummary == null || !methodSummary.hasMutableStackIndex()) {
     return;
   }
   int mutableStackIndex = methodSummary.getMutableStackIndex();
   try {
     Taint stackValue = getFrame().getStackValue(mutableStackIndex);
     // needed especially for constructors
     stackValue.setState(taint.getState());
     for (Location location : taint.getTaintedLocations()) {
       stackValue.addTaintLocation(location, true);
     }
     for (Location location : taint.getPossibleTaintedLocations()) {
       stackValue.addTaintLocation(location, false);
     }
     if (stackValue.hasValidLocalVariableIndex()) {
       int index = stackValue.getLocalVariableIndex();
       getFrame().setValue(index, taint);
     }
     // else we are not able to transfer taint to a local variable
   } catch (DataflowAnalysisException ex) {
     throw new RuntimeException("Bad mutable stack index specification", ex);
   }
 }
Example #2
0
 private void reportBug(BugInstance bugInstance, Taint taint, String currentMethod) {
   if (taint.hasTaintedLocations()) {
     addSourceLines(taint.getTaintedLocations(), bugInstance);
   } else {
     addSourceLines(taint.getPossibleTaintedLocations(), bugInstance);
   }
   if (bugInstance.getPriority() == Priorities.NORMAL_PRIORITY && taint.hasTaintParameters()) {
     delayBugToReport(currentMethod, taint, bugInstance);
   } else {
     bugReporter.reportBug(bugInstance);
   }
 }