public void cloneLocals(int whereToStop) { oldLVtoSandboxLV = new HashMap<>(); List<?> oldLocals = getLocals(); for (int i = 0; i < whereToStop; i++) { Type t = lvs.getLocalTypes().get(i); if (i == 0 && t == null && (access & ACC_STATIC) == 0) t = Type.getType("L" + className + ";"); if (i < firstLocal && t == null) { if ((Opcodes.ACC_STATIC & access) == 0) t = Type.getMethodType(this.desc).getArgumentTypes()[i - 1]; else t = Type.getMethodType(this.desc).getArgumentTypes()[i]; } if (t.getSort() == Type.OBJECT && t.getInternalName().equals("java/lang/Object")) { // Default to the type of what we cloened from for (Object o : oldLocals) { LocalVariableNode lv = (LocalVariableNode) o; if (lv.index + 1 == i) { t = Type.getType(lv.desc); break; } } } int idx = lvs.newLocal(t); oldLVtoSandboxLV.put(i, idx); newLVs.add(new LocalVariableNode("clone_" + i, t.getDescriptor(), null, null, null, idx)); load(i, t); if (t.getSort() == Type.ARRAY || t.getSort() == Type.OBJECT) cloneValAtTopOfStack(t.getDescriptor()); store(idx, t); } }
private void visitVMVMLocalVariable() { if (sandboxVar >= 0 && !sandboxVarVisited && isRegularClass()) { try { sandboxVarVisited = true; super.visitLocalVariable( "secretVMVMD4t4z", Type.getDescriptor(VMState.class), null, start, end, sandboxVar); } catch (NullPointerException ex) { System.err.println( "Unable to visit local variable vmvmSandboxIndx (num " + sandboxVar + ") [labels=" + start + "; " + end + "]" + "[method = " + this.className + "." + this.name + this.desc); ex.printStackTrace(); } } }