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

Verifier fails to detect "uninitialized" target of monitorenter/exit bytecode

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 9, 10
    • hotspot
    • None

      See email discussion: http://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/2017-May/023453.html

      Summary of problem:

      If we create bytecode that does a "new" but which then fails to call invokespecial with a constructor, and uses that "reference" for a monitorenter or monitorexit, the hotspot verifier does not complain. In constrast IBM's J9 fails verification with:

      Exception in thread "main" java.lang.VerifyError: JVMVRFY012 stack shape
      inconsistent; class=Search, method=main([Ljava/lang/String;)V, pc=6
      Exception Details:
        Location:
          Search.main([Ljava/lang/String;)V @6: JBmonitorenter
        Reason:
          Type 'uninitialized' (current frame, stack[1]) is not assignable to
      'java/lang/Object'
        Current Frame:
          bci: @6
          flags: { }
          locals: { 'Search', '[Ljava/lang/String;' }
          stack: { 'uninitialized', 'uninitialized' }
      at T.main(T.java:4)



            dholmes David Holmes
            dholmes David Holmes
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: