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

JNI GetPrimitiveArrayCritical should not be callable on object arrays

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b43
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        In jni.cpp, jni_GetPrimitiveArrayCritical contains the following code (distilled for clarity):

          oop a = JNIHandles::resolve_non_null(array);
          BasicType type;
          if (a->is_objArray()) {
            type = T_OBJECT;
          } else {
            type = typeArrayKlass::cast(a->klass())->element_type();
          }
          return (void*)arrayOop(a)->base(type);


        This implies that an object array reference is a legal argument to GetPrimitiveArrayCritical, but that doesn't make sense. The JNI Spec (not to mention the name of the function itself) implies that it should only be used on primitive arrays.

        As this exposes raw oops through JNI it's clearly illegal and should be fixed.

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                dsimms David Simms
                Reporter:
                sbohne Steve Bohne (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: