null, null); il.append(new PUSH(cpg, nsorts)); il.append(new ANEWARRAY(cpg.addClass(STRING))); for (int level = 0; level < nsorts; level++) { final Sort sort = (Sort)sortObjects.elementAt(level); null, null); il.append(new PUSH(cpg, nsorts)); il.append(new ANEWARRAY(cpg.addClass(STRING))); for (int level = 0; level < nsorts; level++) { final Sort sort = (Sort)sortObjects.elementAt(level); null, null); il.append(new PUSH(cpg, nsorts)); il.append(new ANEWARRAY(cpg.addClass(STRING))); for (int level = 0; level < nsorts; level++) { final Sort sort = (Sort)sortObjects.elementAt(level); null, null); il.append(new PUSH(cpg, nsorts)); il.append(new ANEWARRAY(cpg.addClass(STRING))); for (int level = 0; level < nsorts; level++) { final Sort sort = (Sort)sortObjects.elementAt(level);
@Override public void visitANEWARRAY(ANEWARRAY obj) { consumeStack(obj); Type elementType = obj.getType(getCPG()); pushValue(new ArrayType(elementType, 1)); // We now have an exact type for this value. setTopOfStackIsExact(); }
/** Checks if the constraints of operands of the said instruction(s) are satisfied. */ public void visitANEWARRAY(ANEWARRAY o){ indexValid(o, o.getIndex()); Constant c = cpg.getConstant(o.getIndex()); if (! (c instanceof ConstantClass)){ constraintViolated(o, "Expecting a CONSTANT_Class operand, but found a '"+c+"'."); } Type t = o.getType(cpg); if (t instanceof ArrayType){ int dimensions = ((ArrayType) t).getDimensions(); if (dimensions >= 255){ constraintViolated(o, "Not allowed to create an array with more than 255 dimensions."); } } }
@Override public void visitANEWARRAY(ANEWARRAY obj) { try { getFrame().popValue(); if (FindSecBugsGlobalConfig.getInstance().isDebugTaintState()) { pushSafeDebug("new " + obj.getLoadClassType(cpg).getClassName() + "[]"); } else { pushSafe(); } } catch (DataflowAnalysisException ex) { throw new InvalidBytecodeException("Array length not in the stack", ex); } }
/** Checks if the constraints of operands of the said instruction(s) are satisfied. */ @Override public void visitANEWARRAY(final ANEWARRAY o) { indexValid(o, o.getIndex()); final Constant c = cpg.getConstant(o.getIndex()); if (! (c instanceof ConstantClass)) { constraintViolated(o, "Expecting a CONSTANT_Class operand, but found a '"+c+"'."); } final Type t = o.getType(cpg); if (t instanceof ArrayType) { final int dimensions = ((ArrayType) t).getDimensions(); if (dimensions > Const.MAX_ARRAY_DIMENSIONS) { constraintViolated(o, "Not allowed to create an array with more than "+ Const.MAX_ARRAY_DIMENSIONS + " dimensions;"+ " actual: " + dimensions); } } }
@Override public void visitANEWARRAY(ANEWARRAY obj) { try { getFrame().popValue(); if (FindSecBugsGlobalConfig.getInstance().isDebugTaintState()) { pushSafeDebug("new " + obj.getLoadClassType(cpg).getClassName() + "[]"); } else { pushSafe(); } } catch (DataflowAnalysisException ex) { throw new InvalidBytecodeException("Array length not in the stack", ex); } }
il.append(new ANEWARRAY(cpg.addClass(STRING))); int namesArrayRef = cpg.addFieldref(_className, STATIC_NAMES_ARRAY_FIELD, il.append(new ANEWARRAY(cpg.addClass(STRING))); int urisArrayRef = cpg.addFieldref(_className, STATIC_URIS_ARRAY_FIELD, staticConst.markChunkStart(); il.append(new PUSH(cpg, namespaces.size())); il.append(new ANEWARRAY(cpg.addClass(STRING))); int namespaceArrayRef = cpg.addFieldref(_className, STATIC_NAMESPACE_ARRAY_FIELD, il.append(new ANEWARRAY(cpg.addClass(STRING))); int prefixURIPairsRef = cpg.addFieldref(_className,
public ObjectType getLoadClassType(ConstantPoolGen cpg) { Type t = getType(cpg); if (t instanceof ArrayType){ t = ((ArrayType) t).getBasicType(); } return (t instanceof ObjectType)? (ObjectType) t : null; } }
&& (handles[i + 1].getInstruction() instanceof ANEWARRAY)) { ANEWARRAY an = (ANEWARRAY) handles[i + 1].getInstruction(); ObjectType ty = an.getLoadClassType(cg.getConstantPool()); if (ty == null) continue; String type = ty.toString();
il.append(new ANEWARRAY(cpg.addClass(STRING))); il.append(DUP); il.append(DUP);
@Override public ObjectType getLoadClassType( final ConstantPoolGen cpg ) { Type t = getType(cpg); if (t instanceof ArrayType) { t = ((ArrayType) t).getBasicType(); } return (t instanceof ObjectType) ? (ObjectType) t : null; } }
@SuppressWarnings("unused") // Called using reflection private Instruction createInstructionAnewarray(Element inst) { String classType= inst.getAttributeValue("elementType"); return new ANEWARRAY(constantPoolGen.addClass(classType)); }
/** Symbolically executes the corresponding Java Virtual Machine instruction. */ @Override public void visitANEWARRAY(final ANEWARRAY o) { stack().pop(); //count stack().push( new ArrayType(o.getType(cpg), 1) ); } /** Symbolically executes the corresponding Java Virtual Machine instruction. */
/** Create new array of given size and type. * @return an instruction that creates the corresponding array at runtime, i.e. is an AllocationInstruction */ public Instruction createNewArray(Type t, short dim) { if(dim == 1) { if(t instanceof ObjectType) return new ANEWARRAY(cp.addClass((ObjectType)t)); else if(t instanceof ArrayType) return new ANEWARRAY(cp.addArrayClass((ArrayType)t)); else return new NEWARRAY(((BasicType)t).getType()); } else { ArrayType at; if(t instanceof ArrayType) at = (ArrayType)t; else at = new ArrayType(t, dim); return new MULTIANEWARRAY(cp.addArrayClass(at), dim); } }
@Override public void visitANEWARRAY(ANEWARRAY obj) { consumeStack(obj); Type elementType = obj.getType(getCPG()); pushValue(new ArrayType(elementType, 1)); // We now have an exact type for this value. setTopOfStackIsExact(); }
/** Create new array of given size and type. * @return an instruction that creates the corresponding array at runtime, i.e. is an AllocationInstruction */ public Instruction createNewArray( final Type t, final short dim ) { if (dim == 1) { if (t instanceof ObjectType) { return new ANEWARRAY(cp.addClass((ObjectType) t)); } else if (t instanceof ArrayType) { return new ANEWARRAY(cp.addArrayClass((ArrayType) t)); } else { return new NEWARRAY(t.getType()); } } ArrayType at; if (t instanceof ArrayType) { at = (ArrayType) t; } else { at = new ArrayType(t, dim); } return new MULTIANEWARRAY(cp.addArrayClass(at), dim); }
/** Symbolically executes the corresponding Java Virtual Machine instruction. */ public void visitANEWARRAY(ANEWARRAY o){ stack().pop(); //count stack().push( new ArrayType(o.getType(cpg), 1) ); } /** Symbolically executes the corresponding Java Virtual Machine instruction. */
null, null); il.append(new PUSH(cpg, nsorts)); il.append(new ANEWARRAY(cpg.addClass(STRING))); for (int level = 0; level < nsorts; level++) { final Sort sort = (Sort)sortObjects.elementAt(level); null, null); il.append(new PUSH(cpg, nsorts)); il.append(new ANEWARRAY(cpg.addClass(STRING))); for (int level = 0; level < nsorts; level++) { final Sort sort = (Sort)sortObjects.elementAt(level); null, null); il.append(new PUSH(cpg, nsorts)); il.append(new ANEWARRAY(cpg.addClass(STRING))); for (int level = 0; level < nsorts; level++) { final Sort sort = (Sort)sortObjects.elementAt(level); null, null); il.append(new PUSH(cpg, nsorts)); il.append(new ANEWARRAY(cpg.addClass(STRING))); for (int level = 0; level < nsorts; level++) { final Sort sort = (Sort)sortObjects.elementAt(level);
null, null); il.append(new PUSH(cpg, nsorts)); il.append(new ANEWARRAY(cpg.addClass(STRING))); for (int level = 0; level < nsorts; level++) { final Sort sort = (Sort)sortObjects.elementAt(level); null, null); il.append(new PUSH(cpg, nsorts)); il.append(new ANEWARRAY(cpg.addClass(STRING))); for (int level = 0; level < nsorts; level++) { final Sort sort = (Sort)sortObjects.elementAt(level); null, null); il.append(new PUSH(cpg, nsorts)); il.append(new ANEWARRAY(cpg.addClass(STRING))); for (int level = 0; level < nsorts; level++) { final Sort sort = (Sort)sortObjects.elementAt(level); null, null); il.append(new PUSH(cpg, nsorts)); il.append(new ANEWARRAY(cpg.addClass(STRING))); for (int level = 0; level < nsorts; level++) { final Sort sort = (Sort)sortObjects.elementAt(level);
null, null); il.append(new PUSH(cpg, nsorts)); il.append(new ANEWARRAY(cpg.addClass(STRING))); for (int level = 0; level < nsorts; level++) { final Sort sort = (Sort)sortObjects.elementAt(level); null, null); il.append(new PUSH(cpg, nsorts)); il.append(new ANEWARRAY(cpg.addClass(STRING))); for (int level = 0; level < nsorts; level++) { final Sort sort = (Sort)sortObjects.elementAt(level); null, null); il.append(new PUSH(cpg, nsorts)); il.append(new ANEWARRAY(cpg.addClass(STRING))); for (int level = 0; level < nsorts; level++) { final Sort sort = (Sort)sortObjects.elementAt(level); null, null); il.append(new PUSH(cpg, nsorts)); il.append(new ANEWARRAY(cpg.addClass(STRING))); for (int level = 0; level < nsorts; level++) { final Sort sort = (Sort)sortObjects.elementAt(level);