8189633: Missing -Xcheck:jni checking for DeleteWeakGlobalRef

Added validity check on the handle before deleting it.

Reviewed-by: dholmes, dcubed
This commit is contained in:
Kim Barrett 2019-08-21 19:21:57 -04:00
parent 1acad37ee6
commit 1e1d9319dc

View File

@ -1927,6 +1927,12 @@ JNI_ENTRY_CHECKED(void,
checked_jni_DeleteWeakGlobalRef(JNIEnv *env,
jweak ref))
functionEnterExceptionAllowed(thr);
IN_VM(
if (ref && !JNIHandles::is_weak_global_handle(ref)) {
ReportJNIFatalError(thr,
"Invalid weak global JNI handle passed to DeleteWeakGlobalRef");
}
)
UNCHECKED()->DeleteWeakGlobalRef(env, ref);
functionExit(thr);
JNI_END