protected void internalTransform(Body b, String phaseName, Map options) { PointsToAnalysis pa = Scene.v().getPointsToAnalysis(); Set<IdentityStmt> parms = new HashSet<IdentityStmt>(); for (Iterator sIt = b.getUnits().iterator(); sIt.hasNext();) { final Stmt s = (Stmt) sIt.next(); if (!(s instanceof IdentityStmt)) { continue; } IdentityStmt is = (IdentityStmt) s; ValueBox vb = is.getRightOpBox(); if (!(vb.getValue() instanceof ParameterRef)) { continue; } ParameterRef pr = (ParameterRef) vb.getValue(); if (!(pr.getType() instanceof RefLikeType)) { continue; } parms.add(is); } int colour = 0; while (!parms.isEmpty()) { fill(parms, parms.iterator().next(), colour++, pa); } }
public void caseParameterRef(ParameterRef v) { String oldName = varName; Type paramType = v.getType(); suggestVariableName("paramType"); String paramTypeName = this.varName; ttp.setVariableName(paramTypeName); paramType.apply(ttp); int number = v.getIndex(); suggestVariableName("number"); p.println("int " + varName + "=" + number + ";"); p.println("Value " + oldName + " = Jimple.v().newParameterRef(" + paramTypeName + ", " + varName + ");"); varName = oldName; }
if (returnValueRef != null && (returnValueRef.getType() instanceof RefLikeType || dfa.includesPrimitiveInfoFlow())) { dataFlowGraph.addEdge(r, InfoFlowAnalysis.getNodeForReturnRef(sm));
public void convertToBaf(JimpleToBafContext context, List<Unit> out) { Value currentRhs = getRightOp(); Value newRhs; if (currentRhs instanceof ThisRef) { newRhs = Baf.v().newThisRef((RefType) ((ThisRef) currentRhs).getType()); } else if (currentRhs instanceof ParameterRef) { newRhs = Baf.v().newParameterRef(((ParameterRef) currentRhs).getType(), ((ParameterRef) currentRhs).getIndex()); } else if (currentRhs instanceof CaughtExceptionRef) { Unit u = Baf.v().newStoreInst(RefType.v(), context.getBafLocalOfJimpleLocal((Local) getLeftOp())); u.addAllTagsOf(this); out.add(u); return; } else { throw new RuntimeException("Don't know how to convert unknown rhs"); } Unit u = Baf.v().newIdentityInst(context.getBafLocalOfJimpleLocal((Local) getLeftOp()), newRhs); u.addAllTagsOf(this); out.add(u); }
if (!(param.getType() instanceof RefLikeType) && (!dfa.includesPrimitiveInfoFlow() || method.getName().equals("<init>")))
if (returnValueRef != null && (returnValueRef.getType() instanceof RefLikeType || dfa.includesPrimitiveInfoFlow())) { dataFlowGraph.addEdge(r, InfoFlowAnalysis.getNodeForReturnRef(sm));
ParameterRef p = (ParameterRef) rightOp; if (p.getType() instanceof RefLikeType) { outValue.g.assignParamToLocal(p.getIndex(), left);
return ((ThisRef) expr).getType(); } else if (expr instanceof ParameterRef) { return ((ParameterRef) expr).getType(); } else if (expr instanceof Local) { Local ex = (Local) expr;
protected void internalTransform( Body b, String phaseName, Map options) { PointsToAnalysis pa = Scene.v().getPointsToAnalysis(); Set<IdentityStmt> parms = new HashSet<IdentityStmt>(); for( Iterator sIt = b.getUnits().iterator(); sIt.hasNext(); ) { final Stmt s = (Stmt) sIt.next(); if( !(s instanceof IdentityStmt) ) continue; IdentityStmt is = (IdentityStmt) s; ValueBox vb = is.getRightOpBox(); if( !(vb.getValue() instanceof ParameterRef) ) continue; ParameterRef pr = (ParameterRef) vb.getValue(); if( !(pr.getType() instanceof RefLikeType) ) continue; parms.add(is); } int colour = 0; while( !parms.isEmpty() ) { fill( parms, parms.iterator().next(), colour++, pa ); } } private void fill( Set<IdentityStmt> parms, IdentityStmt parm, int colour, PointsToAnalysis pa ) {
protected void internalTransform( Body b, String phaseName, Map options) { PointsToAnalysis pa = Scene.v().getPointsToAnalysis(); Set<IdentityStmt> parms = new HashSet<IdentityStmt>(); for( Iterator sIt = b.getUnits().iterator(); sIt.hasNext(); ) { final Stmt s = (Stmt) sIt.next(); if( !(s instanceof IdentityStmt) ) continue; IdentityStmt is = (IdentityStmt) s; ValueBox vb = is.getRightOpBox(); if( !(vb.getValue() instanceof ParameterRef) ) continue; ParameterRef pr = (ParameterRef) vb.getValue(); if( !(pr.getType() instanceof RefLikeType) ) continue; parms.add(is); } int colour = 0; while( !parms.isEmpty() ) { fill( parms, parms.iterator().next(), colour++, pa ); } } private void fill( Set<IdentityStmt> parms, IdentityStmt parm, int colour, PointsToAnalysis pa ) {
@Override public SourceInfo getSourceInfo(Stmt sCallSite, InfoflowManager manager) { // If this is not the method we are looking for, we skip it SootMethod currentMethod = manager.getICFG().getMethodOf(sCallSite); if (!isMethodToSummarize(currentMethod)) return null; if (sCallSite instanceof DefinitionStmt) { DefinitionStmt jstmt = (DefinitionStmt) sCallSite; Value leftOp = jstmt.getLeftOp(); Value rightOp = jstmt.getRightOp(); // check if we have a source with apl = 0 (this or parameter source) if (rightOp instanceof ParameterRef) { ParameterRef pref = (ParameterRef) rightOp; logger.debug("source: " + sCallSite + " " + currentMethod.getSignature()); if (debug) System.out.println("source: " + sCallSite + " " + currentMethod.getSignature()); return new SourceInfo(null, manager.getAccessPathFactory().createAccessPath(leftOp, true), Collections.singletonList( sourceSinkFactory.createParameterSource(pref.getIndex(), pref.getType().toString()))); } else if (rightOp instanceof ThisRef) { ThisRef tref = (ThisRef) rightOp; if (debug) System.out.println("source: (this)" + sCallSite + " " + currentMethod.getSignature()); return new SourceInfo(null, manager.getAccessPathFactory().createAccessPath(leftOp, true), Collections.singletonList(sourceSinkFactory.createThisSource(tref.getType().toString()))); } } return null; }
dataFlowGraph.addEdge(r, s); if( returnValueRef != null && (returnValueRef.getType() instanceof RefLikeType || dfa.includesPrimitiveInfoFlow()) ) dataFlowGraph.addEdge(r, InfoFlowAnalysis.getNodeForReturnRef(sm));
dataFlowGraph.addEdge(r, s); if( returnValueRef != null && (returnValueRef.getType() instanceof RefLikeType || dfa.includesPrimitiveInfoFlow()) ) dataFlowGraph.addEdge(r, InfoFlowAnalysis.getNodeForReturnRef(sm));
if( !(param.getType() instanceof RefLikeType) && (!dfa.includesPrimitiveInfoFlow() || method.getName().equals("<init>")) ) // TODO fix
if( !(param.getType() instanceof RefLikeType) && (!dfa.includesPrimitiveInfoFlow() || method.getName().equals("<init>")) ) // TODO fix
dataFlowGraph.addEdge(r, s); if( returnValueRef != null && (returnValueRef.getType() instanceof RefLikeType || dfa.includesPrimitiveInfoFlow())) dataFlowGraph.addEdge(r, InfoFlowAnalysis.getNodeForReturnRef(sm));
dataFlowGraph.addEdge(r, s); if( returnValueRef != null && (returnValueRef.getType() instanceof RefLikeType || dfa.includesPrimitiveInfoFlow())) dataFlowGraph.addEdge(r, InfoFlowAnalysis.getNodeForReturnRef(sm));
ParameterRef p = (ParameterRef)rightOp; if (p.getType() instanceof RefLikeType) o.g.assignParamToLocal(p.getIndex(),left);
ParameterRef p = (ParameterRef)rightOp; if (p.getType() instanceof RefLikeType) o.g.assignParamToLocal(p.getIndex(),left);