Examples of Verifier


Examples of org.apache.bcel.verifier.Verifier

    // the o.getClassType(cpg) type has passed pass 2; see visitLoadClass(o).

    Type t = o.getType(cpg);
    if (t instanceof ObjectType){
      String name = ((ObjectType)t).getClassName();
      Verifier v = VerifierFactory.getVerifier( name );
      VerificationResult vr = v.doPass2();
      if (vr.getStatus() != VerificationResult.VERIFIED_OK){
        constraintViolated((Instruction) o, "Class '"+name+"' is referenced, but cannot be loaded and resolved: '"+vr+"'.");
      }
    }
View Full Code Here

Examples of org.apache.bcel.verifier.Verifier

    // Method is not native, otherwise pass 3 would not happen.
   
    Type t = o.getType(cpg);
    if (t instanceof ObjectType){
      String name = ((ObjectType)t).getClassName();
      Verifier v = VerifierFactory.getVerifier( name );
      VerificationResult vr = v.doPass2();
      if (vr.getStatus() != VerificationResult.VERIFIED_OK){
        constraintViolated((Instruction) o, "Class '"+name+"' is referenced, but cannot be loaded and resolved: '"+vr+"'.");
      }
    }
View Full Code Here

Examples of org.apache.bcel.verifier.Verifier

    // the o.getClassType(cpg) type has passed pass 2; see visitLoadClass(o).

    Type t = o.getType(cpg);
    if (t instanceof ObjectType){
      String name = ((ObjectType)t).getClassName();
      Verifier v = VerifierFactory.getVerifier( name );
      VerificationResult vr = v.doPass2();
      if (vr.getStatus() != VerificationResult.VERIFIED_OK){
        constraintViolated((Instruction) o, "Class '"+name+"' is referenced, but cannot be loaded and resolved: '"+vr+"'.");
      }
    }
View Full Code Here

Examples of org.apache.bcel.verifier.Verifier

     * The referenced class is loaded and pass2-verified.
     */
    public void visitLoadClass(LoadClass o){
      ObjectType t = o.getLoadClassType(cpg);
      if (t != null){// null means "no class is loaded"
        Verifier v = VerifierFactory.getVerifier(t.getClassName());
        VerificationResult vr = v.doPass1();
        if (vr.getStatus() != VerificationResult.VERIFIED_OK){
          constraintViolated((Instruction) o, "Class '"+o.getLoadClassType(cpg).getClassName()+"' is referenced, but cannot be loaded: '"+vr+"'.");
        }
      }
    }
View Full Code Here

Examples of org.apache.bcel.verifier.Verifier

      Type t = o.getReturnType(cpg);
      if (t instanceof ArrayType){
        t = ((ArrayType) t).getBasicType();
      }
      if (t instanceof ObjectType){
        Verifier v = VerifierFactory.getVerifier(((ObjectType) t).getClassName());
        VerificationResult vr = v.doPass2();
        if (vr.getStatus() != VerificationResult.VERIFIED_OK){
          constraintViolated(o, "Return type class/interface could not be verified successfully: '"+vr.getMessage()+"'.");
        }
      }
     
      Type[] ts = o.getArgumentTypes(cpg);
      for (int i=0; i<ts.length; i++){
        t = ts[i];
        if (t instanceof ArrayType){
          t = ((ArrayType) t).getBasicType();
        }
        if (t instanceof ObjectType){
          Verifier v = VerifierFactory.getVerifier(((ObjectType) t).getClassName());
          VerificationResult vr = v.doPass2();
          if (vr.getStatus() != VerificationResult.VERIFIED_OK){
            constraintViolated(o, "Argument type class/interface could not be verified successfully: '"+vr.getMessage()+"'.");
          }
        }
      }
View Full Code Here

Examples of org.apache.bcel.verifier.Verifier

      else{
        String supername = jc.getSuperclassName();
        if (! hs.add(supername)){  // If supername already is in the list
          throw new ClassConstraintException("Circular superclass hierarchy detected.");
        }
        Verifier v = VerifierFactory.getVerifier(supername);
        VerificationResult vr = v.doPass1();

        if (vr != VerificationResult.VR_OK){
          throw new ClassConstraintException("Could not load in ancestor class '"+supername+"'.");
        }
        jc = Repository.lookupClass(supername);
View Full Code Here

Examples of org.apache.bcel.verifier.Verifier

      Type act = t;
      if (act instanceof ArrayType) {
                act = ((ArrayType) act).getBasicType();
            }
      if (act instanceof ObjectType){
        Verifier v = VerifierFactory.getVerifier( ((ObjectType) act).getClassName() );
        VerificationResult vr = v.doPass1();
        if (vr != VerificationResult.VR_OK) {
          throw new ClassConstraintException("Method '"+tostring(obj)+"' has a return type that does not pass verification pass 1: '"+vr+"'.");
        }
      }

      for (int i=0; i<ts.length; i++){
        act = ts[i];
        if (act instanceof ArrayType) {
                    act = ((ArrayType) act).getBasicType();
                }
        if (act instanceof ObjectType){
          Verifier v = VerifierFactory.getVerifier( ((ObjectType) act).getClassName() );
          VerificationResult vr = v.doPass1();
          if (vr != VerificationResult.VR_OK) {
            throw new ClassConstraintException("Method '"+tostring(obj)+"' has an argument type that does not pass verification pass 1: '"+vr+"'.");
          }
        }
      }
View Full Code Here

Examples of org.apache.bcel.verifier.Verifier

          checkIndex(obj, exc_index, CONST_Class);
          ConstantClass cc = (ConstantClass) (cp.getConstant(exc_index));
          checkIndex(cc, cc.getNameIndex(), CONST_Utf8); // cannot be sure this ConstantClass has already been visited (checked)!
          String cname = ((ConstantUtf8) cp.getConstant(cc.getNameIndex())).getBytes().replace('/','.');

          Verifier v = VerifierFactory.getVerifier(cname);
          VerificationResult vr = v.doPass1();

          if (vr != VerificationResult.VR_OK){
            throw new ClassConstraintException("Code attribute '"+tostring(obj)+"' (method '"+m+"') has an exception_table entry '"+tostring(exc_table[i])+"' that references '"+cname+"' as an Exception but it does not pass verification pass 1: "+vr);
          }
          else{
            // We cannot safely trust any other "instanceof" mechanism. We need to transitively verify
            // the ancestor hierarchy.
            JavaClass e = Repository.lookupClass(cname);
            JavaClass t = Repository.lookupClass(Type.THROWABLE.getClassName());
            JavaClass o = Repository.lookupClass(Type.OBJECT.getClassName());
            while (e != o){
              if (e == t) {
                                break; // It's a subclass of Throwable, OKAY, leave.
                            }

              v = VerifierFactory.getVerifier(e.getSuperclassName());
              vr = v.doPass1();
              if (vr != VerificationResult.VR_OK){
                throw new ClassConstraintException("Code attribute '"+tostring(obj)+"' (method '"+m+"') has an exception_table entry '"+tostring(exc_table[i])+"' that references '"+cname+"' as an Exception but '"+e.getSuperclassName()+"' in the ancestor hierachy does not pass verification pass 1: "+vr);
              }
              else{
                e = Repository.lookupClass(e.getSuperclassName());
View Full Code Here

Examples of org.apache.bcel.verifier.Verifier

        ConstantClass cc = (ConstantClass) (cp.getConstant(exc_indices[i]));
        checkIndex(cc, cc.getNameIndex(), CONST_Utf8); // cannot be sure this ConstantClass has already been visited (checked)!
        String cname = ((ConstantUtf8) cp.getConstant(cc.getNameIndex())).getBytes().replace('/','.'); //convert internal notation on-the-fly to external notation

        Verifier v = VerifierFactory.getVerifier(cname);
        VerificationResult vr = v.doPass1();

        if (vr != VerificationResult.VR_OK){
          throw new ClassConstraintException("Exceptions attribute '"+tostring(obj)+"' references '"+cname+"' as an Exception but it does not pass verification pass 1: "+vr);
        }
        else{
          // We cannot safely trust any other "instanceof" mechanism. We need to transitively verify
          // the ancestor hierarchy.
          JavaClass e = Repository.lookupClass(cname);
          JavaClass t = Repository.lookupClass(Type.THROWABLE.getClassName());
          JavaClass o = Repository.lookupClass(Type.OBJECT.getClassName());
          while (e != o){
            if (e == t) {
                            break; // It's a subclass of Throwable, OKAY, leave.
                        }

            v = VerifierFactory.getVerifier(e.getSuperclassName());
            vr = v.doPass1();
            if (vr != VerificationResult.VR_OK){
              throw new ClassConstraintException("Exceptions attribute '"+tostring(obj)+"' references '"+cname+"' as an Exception but '"+e.getSuperclassName()+"' in the ancestor hierachy does not pass verification pass 1: "+vr);
            }
            else{
              e = Repository.lookupClass(e.getSuperclassName());
View Full Code Here

Examples of org.apache.hadoop.oncrpc.security.Verifier

    this.acceptState = acceptState;
  }

  public static RpcAcceptedReply read(int xid, RpcMessage.Type messageType,
      ReplyState replyState, XDR xdr) {
    Verifier verifier = Verifier.readFlavorAndVerifier(xdr);
    AcceptState acceptState = AcceptState.fromValue(xdr.readInt());
    return new RpcAcceptedReply(xid, messageType, replyState, verifier,
        acceptState);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.