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

JNI invocation of an abstract instance method corrupts the stack

XMLWordPrintable

    • b06
    • Verified

        When a class has an abstract method, its vtable/itable is configured to jump to an interpreter stub that simply throws AbstractMethodError. When this stub is executed by JNI however, it does not work correctly and we corrupt the stack.

        To set up the bug you need to define a non-abstract class with an abstract instance method and then use JNI to invoke that instance method. Hence it cannot occur from javac generated class files but requires custom bytecode.

        A simple fix is to have JNI check if the target is abstract and throw the AME directly. Though it may also be possible to fix the stub so that JNI can use it.

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

                Created:
                Updated:
                Resolved: