author | twisti |
Mon, 27 Apr 2015 09:02:41 -0700 | |
changeset 30288 | 476c276de939 |
parent 25054 | 8a12137a8422 |
permissions | -rw-r--r-- |
25054
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
1 |
/* |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
2 |
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
4 |
* |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
8 |
* |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
13 |
* accompanied this code). |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
14 |
* |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
18 |
* |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
21 |
* questions. |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
22 |
*/ |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
23 |
|
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
24 |
/* |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
25 |
* This test has a EnclosingMethod attribute with an illegal |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
26 |
* attribute_length field value of 6. This should cause a |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
27 |
* java.lang.ClassFormatError exception to be thrown. |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
28 |
*/ |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
29 |
|
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
30 |
class EnclMethTest { |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
31 |
0xCAFEBABE; |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
32 |
0; // minor version |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
33 |
52; // version |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
34 |
[22] { // Constant Pool |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
35 |
; // first element is empty |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
36 |
Field #3 #14; // #1 at 0x0A |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
37 |
Method #4 #15; // #2 at 0x0F |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
38 |
class #16; // #3 at 0x14 |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
39 |
class #19; // #4 at 0x17 |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
40 |
Utf8 "this$0"; // #5 at 0x1A |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
41 |
Utf8 "La;"; // #6 at 0x23 |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
42 |
Utf8 "Synthetic"; // #7 at 0x29 |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
43 |
Utf8 "<init>"; // #8 at 0x35 |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
44 |
Utf8 "(Ljava/lang/Object;)V"; // #9 at 0x3E |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
45 |
Utf8 "Code"; // #10 at 0x56 |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
46 |
Utf8 "LineNumberTable"; // #11 at 0x5D |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
47 |
Utf8 "SourceFile"; // #12 at 0x6F |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
48 |
Utf8 "a.java"; // #13 at 0x7C |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
49 |
NameAndType #5 #6; // #14 at 0x85 |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
50 |
NameAndType #8 #20; // #15 at 0x8A |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
51 |
Utf8 "EnclMethTest"; // #16 at 0x8F |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
52 |
Utf8 "Loc"; // #17 at 0x9E |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
53 |
Utf8 "InnerClasses"; // #18 at 0xA4 |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
54 |
Utf8 "java/lang/Object"; // #19 at 0xB3 |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
55 |
Utf8 "()V"; // #20 at 0xC6 |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
56 |
Utf8 "EnclosingMethod"; // #21 at 0xCC |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
57 |
} // Constant Pool |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
58 |
|
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
59 |
0x0000; // access |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
60 |
#3;// this_cpx |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
61 |
#4;// super_cpx |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
62 |
|
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
63 |
[0] { // Interfaces |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
64 |
} // Interfaces |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
65 |
|
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
66 |
[1] { // fields |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
67 |
{ // Member at 0xE8 |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
68 |
0x0000; // access |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
69 |
#5; // name_cpx |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
70 |
#6; // sig_cpx |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
71 |
[1] { // Attributes |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
72 |
Attr(#7, 0) { // Synthetic at 0xF0 |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
73 |
} // end Synthetic |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
74 |
} // Attributes |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
75 |
} // Member |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
76 |
} // fields |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
77 |
|
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
78 |
[1] { // methods |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
79 |
{ // Member at 0xF8 |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
80 |
0x0001; // access |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
81 |
#8; // name_cpx |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
82 |
#20; // sig_cpx |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
83 |
[1] { // Attributes |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
84 |
Attr(#10, 17) { // Code at 0x0100 |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
85 |
2; // max_stack |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
86 |
2; // max_locals |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
87 |
Bytes[5]{ |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
88 |
0x2AB70002B1; |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
89 |
}; |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
90 |
[0] { // Traps |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
91 |
} // end Traps |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
92 |
[0] { // Attributes |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
93 |
} // Attributes |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
94 |
} // end Code |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
95 |
} // Attributes |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
96 |
} // Member |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
97 |
} // methods |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
98 |
|
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
99 |
[3] { // Attributes |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
100 |
Attr(#12, 2) { // SourceFile at 0x0119 |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
101 |
#13; |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
102 |
} // end SourceFile |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
103 |
; |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
104 |
Attr(#18, 10) { // InnerClasses at 0x0121 |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
105 |
[1] { // InnerClasses |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
106 |
#3 #0 #17 0; // at 0x0131 |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
107 |
} |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
108 |
} // end InnerClasses |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
109 |
; |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
110 |
Attr(#21, 6) { // EnclosingMethod at 0x0131 |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
111 |
// invalid length of EnclosingMethod attr: 6 (should be 4) !! |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
112 |
0x0004000F; |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
113 |
} // end EnclosingMethod |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
114 |
} // Attributes |
8a12137a8422
8044738: Check attribute_length of EnclosingMethod attribute
hseigel
parents:
diff
changeset
|
115 |
} // end class EnclMethTest |