30114
|
1 |
/*
|
|
2 |
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 |
*
|
|
5 |
* This code is free software; you can redistribute it and/or modify it
|
|
6 |
* under the terms of the GNU General Public License version 2 only, as
|
|
7 |
* published by the Free Software Foundation.
|
|
8 |
*
|
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
13 |
* accompanied this code).
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License version
|
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
18 |
*
|
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
20 |
* or visit www.oracle.com if you need additional information or have any
|
|
21 |
* questions.
|
|
22 |
*
|
|
23 |
*/
|
|
24 |
|
|
25 |
/*
|
|
26 |
* This class should throw VerifyError because the StackMap for bytecode index
|
|
27 |
* 45 (astore_2, line 123) is incorrect. The stack maps for bytecode indexes 45
|
|
28 |
* and 49 (astore, line 133) do not match because 45 does not supply enough
|
|
29 |
* locals to satisfy 49.
|
|
30 |
*
|
|
31 |
* The astore_2 bytecode at bytecode index 45 changes the type state,
|
|
32 |
* preventing the stackmap mismatch. But, if the incoming type state is used,
|
|
33 |
* as required by JVM Spec 8, then the verifier will detected the stackmap
|
|
34 |
* mismatch, and throw VerifyError.
|
|
35 |
*/
|
|
36 |
|
|
37 |
super public class BadMap
|
|
38 |
version 51:0
|
|
39 |
{
|
|
40 |
|
|
41 |
|
|
42 |
public Method "<init>":"()V"
|
|
43 |
stack 1 locals 1
|
|
44 |
{
|
|
45 |
aload_0;
|
|
46 |
invokespecial Method java/lang/Object."<init>":"()V";
|
|
47 |
return;
|
|
48 |
}
|
|
49 |
|
|
50 |
public static Method main:"([Ljava/lang/String;)V"
|
|
51 |
throws java/lang/Throwable
|
|
52 |
stack 0 locals 1
|
|
53 |
{
|
|
54 |
return;
|
|
55 |
}
|
|
56 |
|
|
57 |
public static Method foo:"()V"
|
|
58 |
stack 3 locals 5
|
|
59 |
{
|
|
60 |
iconst_0;
|
|
61 |
ifne L5;
|
|
62 |
nop;
|
|
63 |
try t7;
|
|
64 |
L5: stack_frame_type full;
|
|
65 |
aconst_null;
|
|
66 |
dup;
|
|
67 |
astore_0;
|
|
68 |
astore_1;
|
|
69 |
try t0;
|
|
70 |
aconst_null;
|
|
71 |
astore_0;
|
|
72 |
endtry t0;
|
|
73 |
goto L19;
|
|
74 |
catch t0 java/io/IOException;
|
|
75 |
stack_frame_type full;
|
|
76 |
locals_map class java/lang/Object, null;
|
|
77 |
stack_map class java/io/IOException;
|
|
78 |
astore_2;
|
|
79 |
aconst_null;
|
|
80 |
dup;
|
|
81 |
astore_1;
|
|
82 |
astore_0;
|
|
83 |
try t1;
|
|
84 |
L19: stack_frame_type full;
|
|
85 |
locals_map class java/lang/Object, class java/lang/Object;
|
|
86 |
aconst_null;
|
|
87 |
astore_2;
|
|
88 |
endtry t1;
|
|
89 |
aload_1;
|
|
90 |
ifnonnull L37;
|
|
91 |
nop;
|
|
92 |
goto L37;
|
|
93 |
catch t1 #0;
|
|
94 |
catch t2 #0;
|
|
95 |
try t2;
|
|
96 |
stack_frame_type full;
|
|
97 |
locals_map class java/lang/Object, class java/lang/Object;
|
|
98 |
stack_map class java/lang/Throwable;
|
|
99 |
astore_3;
|
|
100 |
endtry t2;
|
|
101 |
aload_1;
|
|
102 |
ifnonnull L35;
|
|
103 |
nop;
|
|
104 |
L35: stack_frame_type full;
|
|
105 |
locals_map class java/lang/Object, class java/lang/Object, bogus, class java/lang/Throwable;
|
|
106 |
aload_3;
|
|
107 |
athrow;
|
|
108 |
try t3, t4;
|
|
109 |
L37: stack_frame_type full;
|
|
110 |
locals_map class java/lang/Object, class java/lang/Object, class java/lang/Object;
|
|
111 |
aload_1;
|
|
112 |
ifnonnull L42;
|
|
113 |
nop;
|
|
114 |
endtry t3, t4;
|
|
115 |
L42: stack_frame_type full;
|
|
116 |
locals_map class java/lang/Object, class java/lang/Object, class java/lang/Object;
|
|
117 |
goto L54;
|
|
118 |
catch t3 java/lang/Exception;
|
|
119 |
try t5;
|
|
120 |
stack_frame_type full;
|
|
121 |
locals_map class java/lang/Object, class java/lang/Object;
|
|
122 |
stack_map class java/lang/Exception;
|
|
123 |
astore_2; // astore_2, at bci 45, that changes the type state.
|
|
124 |
endtry t5;
|
|
125 |
goto L54;
|
|
126 |
catch t4 #0;
|
|
127 |
catch t5 #0;
|
|
128 |
catch t6 #0;
|
|
129 |
try t6;
|
|
130 |
stack_frame_type full;
|
|
131 |
locals_map class java/lang/Object, class java/lang/Object, class java/lang/Object;
|
|
132 |
stack_map class java/lang/Throwable;
|
|
133 |
astore 4;
|
|
134 |
endtry t6;
|
|
135 |
aload 4;
|
|
136 |
athrow;
|
|
137 |
L54: stack_frame_type full;
|
|
138 |
locals_map class java/lang/Object, class java/lang/Object, class java/lang/Object;
|
|
139 |
goto L57;
|
|
140 |
L57: stack_frame_type full;
|
|
141 |
locals_map class java/lang/Object, class java/lang/Object, class java/lang/Object;
|
|
142 |
nop;
|
|
143 |
endtry t7;
|
|
144 |
return;
|
|
145 |
catch t7 #0;
|
|
146 |
stack_frame_type full;
|
|
147 |
stack_map class java/lang/Throwable;
|
|
148 |
nop;
|
|
149 |
athrow;
|
|
150 |
}
|
|
151 |
|
|
152 |
} // end Class BadMap
|