soot.jimple.LengthExpr Java Examples

The following examples show how to use soot.jimple.LengthExpr. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ArrayLengthInstruction.java    From JAADAS with GNU General Public License v3.0 6 votes vote down vote up
public void jimplify (DexBody body) {
     if(!(instruction instanceof Instruction12x))
         throw new IllegalArgumentException("Expected Instruction12x but got: "+instruction.getClass());

     Instruction12x lengthOfArrayInstruction = (Instruction12x)instruction;
     int dest = lengthOfArrayInstruction.getRegisterA();

     Local arrayReference = body.getRegisterLocal(lengthOfArrayInstruction.getRegisterB());

     LengthExpr lengthExpr = Jimple.v().newLengthExpr(arrayReference);

     assign = Jimple.v().newAssignStmt(body.getRegisterLocal(dest), lengthExpr);

     setUnit(assign);
     addTags(assign);
     body.add(assign);
     
     if (IDalvikTyper.ENABLE_DVKTYPER) {
Debug.printDbg(IDalvikTyper.DEBUG, "constraint: "+ assign);
       DalvikTyper.v().setType(assign.getLeftOpBox(), IntType.v(), false);      
     }
 }
 
Example #2
Source File: ValueTemplatePrinter.java    From JAADAS with GNU General Public License v3.0 5 votes vote down vote up
public void caseLengthExpr(LengthExpr v) {
	String oldName = varName;
	
	Value op = v.getOp();
	suggestVariableName("op");
	String opName = varName;
	op.apply(this);
	
	p.println("Value "+oldName+" = Jimple.v().newLengthExpr("+opName+");");
	varName = oldName;
}
 
Example #3
Source File: ExprVisitor.java    From JAADAS with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void caseLengthExpr(LengthExpr le) {
	Value array = le.getOp();
	constantV.setOrigStmt(origStmt);
	// In buggy code, the parameter could be a NullConstant.
	// This is why we use .asImmediate() and not .asLocal()
	Register arrayReg = regAlloc.asImmediate(array, constantV);
       stmtV.addInsn(new Insn12x(Opcode.ARRAY_LENGTH, destinationReg, arrayReg), origStmt);
}
 
Example #4
Source File: DavaBody.java    From JAADAS with GNU General Public License v3.0 5 votes vote down vote up
private void javafy_unop_expr(ValueBox vb) {
	UnopExpr uoe = (UnopExpr) vb.getValue();

	javafy(uoe.getOpBox());

	if (uoe instanceof LengthExpr)
		vb.setValue(new DLengthExpr(((LengthExpr) uoe).getOp()));
	else if (uoe instanceof NegExpr)
		vb.setValue(new DNegExpr(((NegExpr) uoe).getOp()));
}
 
Example #5
Source File: JimpleExprVisitorImpl.java    From FuzzDroid with Apache License 2.0 4 votes vote down vote up
@Override
public void caseLengthExpr(LengthExpr v) {
	throw new RuntimeException("todo");
	
}
 
Example #6
Source File: UnitThrowAnalysis.java    From JAADAS with GNU General Public License v3.0 4 votes vote down vote up
public void caseLengthExpr(LengthExpr expr) {
    result = result.add(mgr.NULL_POINTER_EXCEPTION);
    result = result.add(mightThrow(expr.getOp()));
}