Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8021915 | 8 | Mikael Gerdin | P3 | Closed | Fixed | b101 |
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.
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.
- backported by
-
JDK-8021915 JNI GetPrimitiveArrayCritical should not be callable on object arrays
-
- Closed
-
- relates to
-
JDK-8020697 jniCheck.cpp:check_is_obj_array asserts on TypeArrayKlass::cast(aOop->klass())
-
- Closed
-