hotspot/test/runtime/stackMapCheck/BadMapDstore.jasm
author jdv
Tue, 09 Aug 2016 13:45:17 +0530
changeset 40432 6a878eae7459
parent 30114 daa394b459e6
permissions -rw-r--r--
8160456: KSS : resource loading issue in TIFFMetadataFormat.java Reviewed-by: prr, bpb
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
 * 9 (dstore_2, line 60) is incorrect. The stack maps for bytecode indexes 9
daa394b459e6 7127066: Class verifier accepts an invalid class file
hseigel
parents:
diff changeset
    28
 * and 18 (astore_2, line 70) do not match because 9 does not supply enough
daa394b459e6 7127066: Class verifier accepts an invalid class file
hseigel
parents:
diff changeset
    29
 * locals to satisfy 18.
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 dstore_2 bytecode at bytecode index 9 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 BadMapDstore
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
Field blah:I;
daa394b459e6 7127066: Class verifier accepts an invalid class file
hseigel
parents:
diff changeset
    42
daa394b459e6 7127066: Class verifier accepts an invalid class file
hseigel
parents:
diff changeset
    43
public Method "<init>":"()V"
daa394b459e6 7127066: Class verifier accepts an invalid class file
hseigel
parents:
diff changeset
    44
    stack 1 locals 1
daa394b459e6 7127066: Class verifier accepts an invalid class file
hseigel
parents:
diff changeset
    45
{
daa394b459e6 7127066: Class verifier accepts an invalid class file
hseigel
parents:
diff changeset
    46
        aload_0;
daa394b459e6 7127066: Class verifier accepts an invalid class file
hseigel
parents:
diff changeset
    47
        invokespecial    Method java/lang/Object."<init>":"()V";
daa394b459e6 7127066: Class verifier accepts an invalid class file
hseigel
parents:
diff changeset
    48
        return;
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
daa394b459e6 7127066: Class verifier accepts an invalid class file
hseigel
parents:
diff changeset
    51
public static Method main:"([Ljava/lang/String;)V"
daa394b459e6 7127066: Class verifier accepts an invalid class file
hseigel
parents:
diff changeset
    52
    stack 4 locals 4
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
        new    class BadMapDstore;
daa394b459e6 7127066: Class verifier accepts an invalid class file
hseigel
parents:
diff changeset
    55
        dup;
daa394b459e6 7127066: Class verifier accepts an invalid class file
hseigel
parents:
diff changeset
    56
        invokespecial    Method "<init>":"()V";
daa394b459e6 7127066: Class verifier accepts an invalid class file
hseigel
parents:
diff changeset
    57
        astore_1;
daa394b459e6 7127066: Class verifier accepts an invalid class file
hseigel
parents:
diff changeset
    58
        dconst_1;
daa394b459e6 7127066: Class verifier accepts an invalid class file
hseigel
parents:
diff changeset
    59
        try t0;
daa394b459e6 7127066: Class verifier accepts an invalid class file
hseigel
parents:
diff changeset
    60
        dstore_2;
daa394b459e6 7127066: Class verifier accepts an invalid class file
hseigel
parents:
diff changeset
    61
        aload_1;
daa394b459e6 7127066: Class verifier accepts an invalid class file
hseigel
parents:
diff changeset
    62
        iconst_5;
daa394b459e6 7127066: Class verifier accepts an invalid class file
hseigel
parents:
diff changeset
    63
        putfield    Field blah:"I";
daa394b459e6 7127066: Class verifier accepts an invalid class file
hseigel
parents:
diff changeset
    64
        endtry t0;
daa394b459e6 7127066: Class verifier accepts an invalid class file
hseigel
parents:
diff changeset
    65
        goto    L22;
daa394b459e6 7127066: Class verifier accepts an invalid class file
hseigel
parents:
diff changeset
    66
        catch t0 java/lang/Throwable;
daa394b459e6 7127066: Class verifier accepts an invalid class file
hseigel
parents:
diff changeset
    67
        stack_frame_type full;
daa394b459e6 7127066: Class verifier accepts an invalid class file
hseigel
parents:
diff changeset
    68
        locals_map class "[Ljava/lang/String;", class BadMapDstore, double;
daa394b459e6 7127066: Class verifier accepts an invalid class file
hseigel
parents:
diff changeset
    69
        stack_map class java/lang/Throwable;
daa394b459e6 7127066: Class verifier accepts an invalid class file
hseigel
parents:
diff changeset
    70
        astore_2;
daa394b459e6 7127066: Class verifier accepts an invalid class file
hseigel
parents:
diff changeset
    71
        aload_1;
daa394b459e6 7127066: Class verifier accepts an invalid class file
hseigel
parents:
diff changeset
    72
        dconst_0;
daa394b459e6 7127066: Class verifier accepts an invalid class file
hseigel
parents:
diff changeset
    73
        dstore_2;
daa394b459e6 7127066: Class verifier accepts an invalid class file
hseigel
parents:
diff changeset
    74
        pop;
daa394b459e6 7127066: Class verifier accepts an invalid class file
hseigel
parents:
diff changeset
    75
    L22:    stack_frame_type same;
daa394b459e6 7127066: Class verifier accepts an invalid class file
hseigel
parents:
diff changeset
    76
        return;
daa394b459e6 7127066: Class verifier accepts an invalid class file
hseigel
parents:
diff changeset
    77
}
daa394b459e6 7127066: Class verifier accepts an invalid class file
hseigel
parents:
diff changeset
    78
daa394b459e6 7127066: Class verifier accepts an invalid class file
hseigel
parents:
diff changeset
    79
} // end Class BadMapDstore