test/runtime/classFileParserBug/emptyNameUtf8.jcod

changeset 8454
9d07e8518392
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/runtime/classFileParserBug/emptyNameUtf8.jcod	Tue Jul 12 22:31:57 2016 +0000
     1.3 @@ -0,0 +1,131 @@
     1.4 +/*
     1.5 + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.
    1.11 + *
    1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.15 + * version 2 for more details (a copy is included in the LICENSE file that
    1.16 + * accompanied this code).
    1.17 + *
    1.18 + * You should have received a copy of the GNU General Public License version
    1.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.21 + *
    1.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.23 + * or visit www.oracle.com if you need additional information or have any
    1.24 + * questions.
    1.25 + *
    1.26 + */
    1.27 +
    1.28 +// This class has an illegal NameAndType at constant pool #4.  It's illegal because
    1.29 +// the Utf8 that it points to at #27 is a zero length string which is not a valid
    1.30 +// name.  Loading this class should cause a ClassFormatError exception.
    1.31 +class emptyNameUtf8 {
    1.32 +  0xCAFEBABE;
    1.33 +  0; // minor version
    1.34 +  52; // version
    1.35 +  [29] { // Constant Pool
    1.36 +    ; // first element is empty
    1.37 +    Method #6 #15; // #1     at 0x0A
    1.38 +    Field #16 #17; // #2     at 0x0F
    1.39 +    String #18; // #3     at 0x14
    1.40 +    NameAndType #27 #28; // #4     at 0x9F
    1.41 +    class #21; // #5     at 0x1C
    1.42 +    class #22; // #6     at 0x1F
    1.43 +    Utf8 "<init>"; // #7     at 0x22
    1.44 +    Utf8 "()V"; // #8     at 0x2B
    1.45 +    Utf8 "Code"; // #9     at 0x2E
    1.46 +    Utf8 "LineNumberTable"; // #10     at 0x35
    1.47 +    Utf8 "main"; // #11     at 0x47
    1.48 +    Utf8 "([Ljava/lang/String;)V"; // #12     at 0x4E
    1.49 +    Utf8 "SourceFile"; // #13     at 0x67
    1.50 +    Utf8 "emptyNameUtf8.java"; // #14     at 0x74
    1.51 +    NameAndType #7 #8; // #15     at 0x81
    1.52 +    class #23; // #16     at 0x86
    1.53 +    NameAndType #24 #25; // #17     at 0x89
    1.54 +    Utf8 "Hello World"; // #18     at 0x8E
    1.55 +    class #26; // #19     at 0x9C
    1.56 +    Method #19 #4; // #20     at 0x17
    1.57 +    Utf8 "emptyNameUtf8"; // #21     at 0xA4
    1.58 +    Utf8 "java/lang/Object"; // #22     at 0xAC
    1.59 +    Utf8 "java/lang/System"; // #23     at 0xBF
    1.60 +    Utf8 "out"; // #24     at 0xD2
    1.61 +    Utf8 "Ljava/io/PrintStream;"; // #25     at 0xD8
    1.62 +    Utf8 "java/io/PrintStream"; // #26     at 0xF0
    1.63 +    Utf8 ""; // #27     at 0x0106
    1.64 +    Utf8 "()V"; // #28     at 0x0110
    1.65 +  } // Constant Pool
    1.66 +
    1.67 +  0x0021; // access
    1.68 +  #5;// this_cpx
    1.69 +  #6;// super_cpx
    1.70 +
    1.71 +  [0] { // Interfaces
    1.72 +  } // Interfaces
    1.73 +
    1.74 +  [0] { // fields
    1.75 +  } // fields
    1.76 +
    1.77 +  [2] { // methods
    1.78 +    { // Member at 0x0134
    1.79 +      0x0001; // access
    1.80 +      #7; // name_cpx
    1.81 +      #8; // sig_cpx
    1.82 +      [1] { // Attributes
    1.83 +        Attr(#9, 29) { // Code at 0x013C
    1.84 +          1; // max_stack
    1.85 +          1; // max_locals
    1.86 +          Bytes[5]{
    1.87 +            0x2AB70001B1;
    1.88 +          };
    1.89 +          [0] { // Traps
    1.90 +          } // end Traps
    1.91 +          [1] { // Attributes
    1.92 +            Attr(#10, 6) { // LineNumberTable at 0x0153
    1.93 +              [1] { // LineNumberTable
    1.94 +                0  2; //  at 0x015F
    1.95 +              }
    1.96 +            } // end LineNumberTable
    1.97 +          } // Attributes
    1.98 +        } // end Code
    1.99 +      } // Attributes
   1.100 +    } // Member
   1.101 +    ;
   1.102 +    { // Member at 0x015F
   1.103 +      0x0009; // access
   1.104 +      #11; // name_cpx
   1.105 +      #12; // sig_cpx
   1.106 +      [1] { // Attributes
   1.107 +        Attr(#9, 37) { // Code at 0x0167
   1.108 +          2; // max_stack
   1.109 +          1; // max_locals
   1.110 +          Bytes[9]{
   1.111 +            0xB200021203B60004;
   1.112 +            0xB1;
   1.113 +          };
   1.114 +          [0] { // Traps
   1.115 +          } // end Traps
   1.116 +          [1] { // Attributes
   1.117 +            Attr(#10, 10) { // LineNumberTable at 0x0182
   1.118 +              [2] { // LineNumberTable
   1.119 +                0  4; //  at 0x018E
   1.120 +                8  5; //  at 0x0192
   1.121 +              }
   1.122 +            } // end LineNumberTable
   1.123 +          } // Attributes
   1.124 +        } // end Code
   1.125 +      } // Attributes
   1.126 +    } // Member
   1.127 +  } // methods
   1.128 +
   1.129 +  [1] { // Attributes
   1.130 +    Attr(#13, 2) { // SourceFile at 0x0194
   1.131 +      #14;
   1.132 +    } // end SourceFile
   1.133 +  } // Attributes
   1.134 +} // end class emptyNameUtf8

mercurial