@Override public String toFIString(Unit u) { StringBuilder sb = new StringBuilder(); boolean printId = Utils.buildBoolProperty("petablox.printrel.printID", false); if (printId) sb.append("(" + indexOf(u) + ")"); InvokeExpr ie = SootUtilities.getInvokeExpr(u); if (ie instanceof DynamicInvokeExpr) { return ""; } if (SootUtilities.isInterfaceInvoke(u)) sb.append("INTERFACEINVK:"); else if (SootUtilities.isVirtualInvoke(u)) sb.append("VIRTUALINVK:"); else if (SootUtilities.isStaticInvoke(u)) sb.append("STATICINVK:"); else if (SootUtilities.isInstanceInvoke(u)) sb.append("SPECINVK:"); SootMethod m = SootUtilities.getInvokeExpr(u).getMethod(); sb.append(m.getName() + "@" + m.getDeclaringClass().getName() + "@" + SootUtilities.toJavaLocStr(u)); return sb.toString(); }
@Override public void fill() { DomI domI = (DomI) doms[0]; int numI = domI.size(); for (int i = 0; i < numI; i++) { Unit q = domI.get(i); if(SootUtilities.isInvoke(q)) { InvokeExpr ie = SootUtilities.getInvokeExpr(q); if(ie instanceof DynamicInvokeExpr) continue; SootMethod m = ie.getMethod(); if (m.getDeclaringClass().getName().equals("java.lang.Thread") && m.getName().toString().equals("<init>")) { add(i); } } } }
@Override public void fill() { DomI domI = (DomI) doms[0]; int numI = domI.size(); for (int i = 0; i < numI; i++) { Unit q = domI.get(i); if(SootUtilities.isInvoke(q)) { InvokeExpr ie = SootUtilities.getInvokeExpr(q); if(ie instanceof DynamicInvokeExpr) continue; SootMethod m = ie.getMethod(); if (m.getName().toString().equals("start") && //m.getDesc().toString().equals("()V") && m.getParameterCount() == 0 && (m.getReturnType() instanceof VoidType) && m.getDeclaringClass().getName().equals("java.lang.Thread")) { add(i); } } } }
@Override public void caseDynamicInvokeExpr(DynamicInvokeExpr v) { logger.fine("Invoke expression is of type DynamicInvoke"); logger.finest(v.toString()); rightElement = RightElement.NOT; if (actualContext == StmtContext.INVOKE || actualContext == StmtContext.ASSIGNRIGHT ) { Local[] args = vh.getArgumentsForInvokedMethod(v); String method = v.getMethod().toString(); if (ExternalClasses.methodMap.containsKey(method)) { logger.fine("Found an external class " + method); logger.fine("This class is treated in a special way"); ExternalClasses.receiveCommand(method, callingStmt, args); } else { logger.fine("Found an external class " + method); logger.fine("This class is treated as an internal class"); JimpleInjector.storeArgumentLevels(callingStmt, args); } } else { throw new InternalAnalyzerException( "Unexpected Context for Invoke Expression"); } }
public void visit(Value e) { add(e); if (e instanceof DynamicInvokeExpr) { DynamicInvokeExpr ex = (DynamicInvokeExpr) e; for (Value arg : ex.getBootstrapArgs()) add(arg); } }
@Override public void visit(InvokeExpr e) { int numActuals = 0; if (e instanceof InstanceInvokeExpr) { numActuals = 1 + e.getArgs().size(); } else if (e instanceof DynamicInvokeExpr) { DynamicInvokeExpr ex = (DynamicInvokeExpr) e; int numBootstrapArgs = ex.getBootstrapArgs().size(); numActuals = Math.max(e.getArgs().size(), numBootstrapArgs); } else { numActuals = e.getArgs().size(); } if (numActuals > maxArgs) grow(numActuals); }
@Override public void caseDynamicInvokeExpr(DynamicInvokeExpr v) { SootClass sootClass = v.getMethod().getDeclaringClass(); handleStatic(sootClass); handleInvoke(v); addProgramCounterConstraint(sootClass.getName()); }
@Override public void caseDynamicInvokeExpr(DynamicInvokeExpr v) { // caseInvokeExpr(v, null); throw new RuntimeException("todo"); }
public void caseDynamicInvokeExpr(DynamicInvokeExpr v) { printInvokeExpr(v); }
@Override public void caseDynamicInvokeExpr(DynamicInvokeExpr v) { throw new Error("DynamicInvokeExpr not supported: " + v); }
public void caseDynamicInvokeExpr(DynamicInvokeExpr expr) { //caseInstanceInvokeExpr(expr); }
@Override public void caseDynamicInvokeExpr(DynamicInvokeExpr arg0) { throw new RuntimeException("This must be handeled by SootStmtSwitch!"); }
@Override public void caseDynamicInvokeExpr(DynamicInvokeExpr v) { throwInvalidWriteException(v); }
/** * The method should update the <em>security level</em> of an invoke * expression with type {@link DynamicInvokeExpr}, but it is not possible to * update the level of an invoke expression. * * @param v * The invoke expression for which the <em>security level</em> * should be updated. * @see soot.jimple.ExprSwitch#caseDynamicInvokeExpr(soot.jimple.DynamicInvokeExpr) * @throws InvalidSwitchException * Always, because the update is not possible. */ @Override public void caseDynamicInvokeExpr(DynamicInvokeExpr v) { throw new SwitchException(getMsg("exception.analysis.switch.update_error", this.getClass().getSimpleName(), v.getClass().getSimpleName(), v.toString(), getSourceLine())); }
/** * DOC * * @see soot.jimple.ExprSwitch#caseDynamicInvokeExpr(soot.jimple.DynamicInvokeExpr) */ @Override public void caseDynamicInvokeExpr(DynamicInvokeExpr v) { this.extractor.addMethodEnvironmentForMethod(v.getMethod()); }
/** * Looks up the <em>security level</em> of the given invoke expression with * the type {@link DynamicInvokeExpr} and stores the resulting level in * {@link SecurityLevelValueReadSwitch#level}. Also the parameter * <em>security level</em> and the <em>write effects</em> will be handled. * * @param v * The invoke expression, for which the level should be looked * up. * @see soot.jimple.ExprSwitch#caseDynamicInvokeExpr(soot.jimple.DynamicInvokeExpr) * @see SecurityLevelValueReadSwitch#handleInvokeExpr(InvokeExpr) */ @Override public void caseDynamicInvokeExpr(DynamicInvokeExpr v) { handleInvokeExpr(v); }