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