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

5.4.3.5: REF_invokeSpecial behavior should enforce sender/receiver relationship

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 8
    • Fix Version/s: 9
    • Component/s: specification
    • Labels:
    • Subcomponent:
      vm

      Description

      JVMS8 says that method handle of kind REF_invokeSpecial has the following bytecode behavior
          invokespecial C.m:(A*)T
      and descriptor
          (C,A*)T
      where C - class that contains target method, A* - target method parameters, T - target method return type

      Such description does not consider specific checks performed for invokespecial instruction:
      1. invokespecial may only invoke method defined in a superclass or a current class. Therefore, if C is not the current class or a superclass then resolution must fail. Otherwise, it would be possible to effectively do invokespecial on another class.
      2. invokespecial may only be invoked on instance of the current class or a subclass. Therefore, method handle type descriptor must be (CurrentClass, A*)T. Otherwise, it would be possible to effectively do invokespecial on superclass instance.

      For comparison, MethodHandles.Lookup.findSpecial() specification has both of this constraints.
      HotSpot also provides this both constraints (which makes it formally incompatible with spec).

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                abuckley Alex Buckley
                Reporter:
                kfertikov Kirill Fertikov (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: