/** * Extract the number from a push operation (BIPUSH/SIPUSH). * * @param h Instruction Handle * @return The constant number if any is found */ public static Number getPushNumber(InstructionHandle h) { Instruction prevIns = h.getInstruction(); if (prevIns instanceof BIPUSH) { BIPUSH ldcCipher = (BIPUSH) prevIns; return ldcCipher.getValue(); } else if (prevIns instanceof SIPUSH) { SIPUSH ldcCipher = (SIPUSH) prevIns; return ldcCipher.getValue(); } return null; }
@Override public void visitSIPUSH(SIPUSH obj) { Number value = obj.getValue(); Constant c = new Constant(value); getFrame().pushValue(c); }
public boolean isAssertionHandle(InstructionHandle handle, ConstantPoolGen cpg) { Instruction ins = handle.getInstruction(); if (isAssertionInstruction(ins, cpg)) { return true; } if (ins instanceof SIPUSH) { int v = ((SIPUSH) ins).getValue().intValue(); if (v == 500) { Instruction next = handle.getNext().getInstruction(); if (next instanceof INVOKEINTERFACE) { INVOKEINTERFACE iInterface = (INVOKEINTERFACE) next; String className = iInterface.getClassName(cpg); String fieldName = iInterface.getMethodName(cpg); if ("javax.servlet.http.HttpServletResponse".equals(className) && "setStatus".equals(fieldName)) { return true; } } } } return false; }
public static int getValueOfNumber(Instruction ins, ConstantPoolGen cpg) { if (ins instanceof BIPUSH) { return ((BIPUSH) ins).getValue().intValue(); } else if (ins instanceof SIPUSH) { return ((SIPUSH) ins).getValue().intValue(); } else if (ins instanceof ICONST) { return ((ICONST) ins).getValue().intValue(); } else if (ins instanceof LDC_W) { LDC_W ldcw = (LDC_W) ins; return Integer.valueOf(ldcw.getValue(cpg).toString()); } else { return -1; } }
/** * Extract the number from a push operation (BIPUSH/SIPUSH). * * @param h Instruction Handle * @return The constant number if any is found */ public static Number getPushNumber(InstructionHandle h) { Instruction prevIns = h.getInstruction(); if (prevIns instanceof BIPUSH) { BIPUSH ldcCipher = (BIPUSH) prevIns; return ldcCipher.getValue(); } else if (prevIns instanceof SIPUSH) { SIPUSH ldcCipher = (SIPUSH) prevIns; return ldcCipher.getValue(); } return null; }
@Override public void visitSIPUSH(SIPUSH obj) { Taint taint = new Taint(Taint.State.SAFE); // assume each pushed short is a char (for non-ASCII characters) taint.setConstantValue(String.valueOf((char) obj.getValue().shortValue())); getFrame().pushValue(taint); }
@Override public void visitSIPUSH(SIPUSH obj) { Taint taint = new Taint(Taint.State.SAFE); // assume each pushed short is a char (for non-ASCII characters) taint.setConstantValue(String.valueOf((char) obj.getValue().shortValue())); getFrame().pushValue(taint); }
@Override public void visitSIPUSH(SIPUSH obj) { Number value = obj.getValue(); Constant c = new Constant(value); getFrame().pushValue(c); }
public boolean isAssertionHandle(InstructionHandle handle, ConstantPoolGen cpg) { Instruction ins = handle.getInstruction(); if (isAssertionInstruction(ins, cpg)) { return true; } if (ins instanceof SIPUSH) { int v = ((SIPUSH) ins).getValue().intValue(); if (v == 500) { Instruction next = handle.getNext().getInstruction(); if (next instanceof INVOKEINTERFACE) { INVOKEINTERFACE iInterface = (INVOKEINTERFACE) next; String className = iInterface.getClassName(cpg); String fieldName = iInterface.getMethodName(cpg); if ("javax.servlet.http.HttpServletResponse".equals(className) && "setStatus".equals(fieldName)) { return true; } } } } return false; }
push = ((BIPUSH) handles[i + 1].getInstruction()).getValue().intValue(); } else if (handles[i + 1].getInstruction() instanceof SIPUSH) { push = ((SIPUSH) handles[i + 1].getInstruction()).getValue().intValue(); } else { push = ((ICONST) handles[i + 1].getInstruction()).getValue().intValue();