Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4954363

JVM accepts class with invalid stackmaps order

    Details

    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      Name: viR10068 Date: 11/14/2003


      The spec ClassFileFormat.pdf says:
      "The stackmaps are in monotonically increasing order."

      But the JVM (1.5.0-beta-b28) accepts class files with
      not monotonically increasing order for stackmaps.

      The new JCK tests are failed due to this error:
      vm/cldc/typechecker/rules/rules002/rules00202m2/rules00202m2.html
      vm/cldc/typechecker/rules/rules002/rules00202m4/rules00202m4.html
      vm/cldc/typechecker/rules/rules002/rules00202m5/rules00202m5.html

      The test source:
      --------------------- test18.jcod ---------------------------
      class test18 {
        0xCAFEBABE;
        0;
        49;
        [] { // Constant Pool
          ; // first element is empty
          Method #3 #5; // #1
          Utf8 "StackMap"; // #2
          class #4; // #3
          Utf8 "java/lang/Object"; // #4
          NameAndType #10 #6; // #5
          Utf8 "()V"; // #6
          Utf8 "m"; // #7
          Utf8 "Code"; // #8
          class #11; // #9
          Utf8 "<init>"; // #10
          Utf8 "test18"; // #11
        } // Constant Pool

        0x0021; // access
        #9;// this_cpx
        #3;// super_cpx

        [] { // Interfaces
        } // Interfaces

        [] { // fields
        } // fields

        [] { // methods
          { // Member
            0x0001; // access
            #10; // name_cpx
            #6; // sig_cpx
            [] { // Attributes
              Attr(#8) { // Code
                1; // max_stack
                1; // max_locals
                Bytes[]{
                  0x2AB70001B1;
                };
                [] { // Traps
                } // end Traps
                [] { // Attributes
                } // Attributes
              } // end Code
            } // Attributes
          } // Member
          ;
          { // Member
            0x0001; // access
            #7; // name_cpx
            #6; // sig_cpx
            [] { // Attributes
              Attr(#8) { // Code
                0; // max_stack
                1; // max_locals
                Bytes[]{
                  0x0000B1;
                };
                [] { // Traps
                } // end Traps
                [] { // Attributes
                  Attr(#2) { // StackMap
                    [] { //
                      2, []{}, []{};
                      1, []{}, []{};
                      0, []{}, []{};
                    }
                  } // end StackMap
                } // Attributes
              } // end Code
            } // Attributes
          } // Member
        } // methods

        [] {} // Attributes
      }
      -------------------------------------------------------------
      The execution log:
      % jdk1.5.0-b28/solaris-sparc/bin/java -showversion -Xfuture test18
      java version "1.5.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b28)
      Java HotSpot(TM) Client VM (build 1.5.0-beta-b28, mixed mode)

      Exception in thread "main" java.lang.NoSuchMethodError: main
      %

      ======================================================================

        Attachments

          Activity

            People

            • Assignee:
              myangsunw Mingyao Yang (Inactive)
              Reporter:
              vivsunw Viv Viv (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: