public void caseTableSwitchStmt(TableSwitchStmt stmt) { p.openBlock(); String varName = printValueAssignment(stmt.getKey(),"key"); int lowIndex= stmt.getLowIndex(); p.println("int lowIndex=" + lowIndex + ";"); int highIndex= stmt.getHighIndex(); p.println("int highIndex=" + highIndex + ";"); p.println("List<Unit> targets = new LinkedList<Unit>();"); for(Unit s: stmt.getTargets()) { String nameOfJumpTarget = nameOfJumpTarget(s); p.println("targets.add("+nameOfJumpTarget+")"); } Unit defaultTarget = stmt.getDefaultTarget(); p.println("Unit defaultTarget = " + nameOfJumpTarget(defaultTarget) + ";"); printStmt(stmt, varName, "lowIndex", "highIndex", "targets", "defaultTarget"); p.closeBlock(); }
private void convertTableSwitchInsn(TableSwitchInsnNode insn) { StackFrame frame = getFrame(insn); if (units.containsKey(insn)) { frame.mergeIn(pop()); return; } Operand key = popImmediate(); UnitBox dflt = Jimple.v().newStmtBox(null); List<UnitBox> targets = new ArrayList<UnitBox>(insn.labels.size()); labels.put(insn.dflt, dflt); for (LabelNode ln : insn.labels) { UnitBox box = Jimple.v().newStmtBox(null); targets.add(box); labels.put(ln, box); } TableSwitchStmt tss = Jimple.v().newTableSwitchStmt(key.stackOrValue(), insn.min, insn.max, targets, dflt); key.addBox(tss.getKeyBox()); frame.in(key); frame.boxes(tss.getKeyBox()); setUnit(insn, tss); }
public void caseTableSwitchStmt(TableSwitchStmt stmt) { Value key = stmt.getKey(); if (key instanceof Local) { if (!ClassHierarchy.v().typeNode(((Local) key).getType()) .hasAncestor_1(ClassHierarchy.v().INT)) { if (fix) { stmt.setKey(insertCast((Local) key, IntType.v(), stmt)); } else { error("Type Error(20)"); } } resolver.typeVariable((Local) key).addParent(resolver.INT); } }
public void caseTableSwitchStmt(TableSwitchStmt stmt) { if (uses) { Value key = stmt.getKey(); if (key instanceof Local) { resolver.typeVariable((Local) key).addParent(resolver.INT); } } }
public void caseTableSwitchStmt(TableSwitchStmt stmt) { if (uses) { Value key = stmt.getKey(); if (key instanceof Local) { resolver.typeVariable((Local) key).addParent(resolver.typeVariable(IntType.v())); } } }
@Override public void caseTableSwitchStmt(TableSwitchStmt stmt) { exprV.setOrigStmt(stmt); constantV.setOrigStmt(stmt); // create payload that references the switch's targets int firstKey = stmt.getLowIndex(); List<Unit> targets = stmt.getTargets(); PackedSwitchPayload payload = new PackedSwitchPayload(firstKey, targets); switchPayloads.add(payload); // create packed-switch instruction that references the payload Value key = stmt.getKey(); Stmt defaultTarget = (Stmt) stmt.getDefaultTarget(); addInsn(buildSwitchInsn(Opcode.PACKED_SWITCH, key, defaultTarget, payload, stmt), stmt); }
@Override public void caseTableSwitchStmt(TableSwitchStmt stmt) { logger.fine("\n > > > Table switch statement identified < < <"); valueSwitch.callingStmt = stmt; logger.finest("Use and def boxes of SwitchStmt: " + stmt.getUseAndDefBoxes().toString()); // Check for all values in the condition if they are a constant value // or if they are stored in a local. In the second case the local is // added // to a list for the locals. List<ValueBox> valueList = stmt.getUseBoxes(); ArrayList<Local> localList = new ArrayList<Local>(); for (ValueBox v : valueList) { Value val = v.getValue(); if (val instanceof Local) { localList.add((Local) val); logger.fine("New local added to local-list of SwitchStmt: " + val); } } int localListLength = localList.size(); Local[] arguments = new Local[localListLength]; for (int i = 0; i < localListLength; i++) { arguments[i] = localList.get(i); } JimpleInjector.checkCondition(stmt, arguments); }
@Override public void caseTableSwitchStmt(TableSwitchStmt stmt) { logger.fine("\n > > > Table switch statement identified < < <"); logger.finest("Use and def boxes of SwitchStmt: " + stmt.getUseAndDefBoxes().toString()); // Check for all values in the condition if they are a constant value // or if they are stored in a local. In the second case the local is // added // to a list for the locals. List<ValueBox> valueList = stmt.getUseBoxes(); ArrayList<Local> localList = new ArrayList<Local>(); for (ValueBox v : valueList) { Value val = v.getValue(); if (val instanceof Local) { localList.add((Local) val); logger.fine("New local added to local-list of SwitchStmt: " + val); } } int localListLength = localList.size(); Local[] arguments = new Local[localListLength]; for (int i = 0; i < localListLength; i++) { arguments[i] = localList.get(i); } JimpleInjector.checkCondition(stmt, arguments); }
@Override public void caseTableSwitchStmt(TableSwitchStmt stmt) { throw new RuntimeException("todo"); }
public void caseTableSwitchStmt(TableSwitchStmt stmt) { stmt.setKey(this.uv.visit(stmt.getKey(), IntType.v(), stmt)); }
@Override public void caseTableSwitchStmt(TableSwitchStmt s) { result = result.add(mightThrow(s.getKey())); }
@Override public void caseTableSwitchStmt(TableSwitchStmt stmt) { handleBranch(stmt.getKey(), new TableSwitchProgramCounterTrigger(stmt)); }
public TableSwitchProgramCounterTrigger(TableSwitchStmt stmt) { this.stmt = stmt; }
public final TableSwitchStmt getTableSwitchStmt() { return stmt; }
/** * Method, which should process the given statement of type * {@link TableSwitchStmt}, but is not implemented in the current version of * this method. If method will be called an exception is thrown. * * @param stmt * Statement that should be processed to check for security * violations. * @see soot.jimple.StmtSwitch#caseTableSwitchStmt(soot.jimple.TableSwitchStmt) * @throws UnimplementedSwitchException * Method throws always this exception, because the method is * not implemented. */ @Override public void caseTableSwitchStmt(TableSwitchStmt stmt) { throw new SwitchException(getMsg("exception.analysis.switch.not_implemented", stmt.toString(), getSourceLine(), stmt.getClass().getSimpleName(), this.getClass().getSimpleName())); }
/** * DOC * * @see soot.jimple.StmtSwitch#caseTableSwitchStmt(soot.jimple.TableSwitchStmt) */ @Override public void caseTableSwitchStmt(TableSwitchStmt stmt) { // TODO: Consider reaction }