@Override public void visitAASTORE(AASTORE obj) { try { Taint valueTaint = getFrame().popValue(); getFrame().popValue(); // array index Taint arrayTaint = getFrame().popValue(); Taint merge = Taint.merge(valueTaint, arrayTaint); setLocalVariableTaint(merge, arrayTaint); Taint stackTop = null; if (getFrame().getStackDepth() > 0) { stackTop = getFrame().getTopValue(); } // varargs use duplicated values if (stackTop == arrayTaint) { getFrame().popValue(); getFrame().pushValue(new Taint(merge)); } } catch (DataflowAnalysisException ex) { throw new InvalidBytecodeException("Not enough values on the stack", ex); } }
public void storeLocal(int pc, int slot) { boolean isupval = pi.isUpvalueAssign(pc, slot); int index = findSlotIndex( slot, isupval ); if (isupval) { boolean isupcreate = pi.isUpvalueCreate(pc, slot); if ( isupcreate ) { append(factory.createInvoke(classname, "newupe", TYPE_LOCALUPVALUE, ARG_TYPES_NONE, Constants.INVOKESTATIC)); append(InstructionConstants.DUP); append(new ASTORE(index)); } else { append(new ALOAD(index)); } append(InstructionConstants.SWAP); append(new PUSH(cp, 0)); append(InstructionConstants.SWAP); append(InstructionConstants.AASTORE); } else { append(new ASTORE(index)); } }
public void storeUpvalue(int pc, int upindex, int slot) { boolean isrw = pi.isReadWriteUpvalue( pi.upvals[upindex] ); append(InstructionConstants.THIS); if ( isrw ) { append(factory.createFieldAccess(classname, upvalueName(upindex), TYPE_LOCALUPVALUE, Constants.GETFIELD)); append(new PUSH(cp,0)); loadLocal(pc, slot); append(InstructionConstants.AASTORE); } else { loadLocal(pc, slot); append(factory.createFieldAccess(classname, upvalueName(upindex), TYPE_LUAVALUE, Constants.PUTFIELD)); } }
public void loadArrayArgs(int pc, int firstslot, int nargs) { append(new PUSH(cp, nargs)); append(new ANEWARRAY(cp.addClass(STR_LUAVALUE))); for ( int i=0; i<nargs; i++ ) { append(InstructionConstants.DUP); append(new PUSH(cp, i)); loadLocal(pc, firstslot++); append(new AASTORE()); } }
public boolean isArrayStore(Instruction instruction) { return instruction instanceof AASTORE || instruction instanceof BASTORE || instruction instanceof CASTORE || instruction instanceof DASTORE || instruction instanceof FASTORE || instruction instanceof IASTORE || instruction instanceof LASTORE || instruction instanceof SASTORE; }
@SuppressWarnings("unused") // Called using reflection private Instruction createInstructionAastore(Element inst) { return new AASTORE(); }
@Override public void visitAASTORE(AASTORE arr) { handleArrayStore(arr); }