8140665: SIGSEGV when a primitive type's class is used as the host class in a call to DefineAnonymousClass call

Instead of assertng, throw an exception

Reviewed-by: acorn, coleenp
This commit is contained in:
Harold Seigel 2016-03-24 08:13:28 -04:00
parent 49d6460189
commit ff8f7e4a2b
2 changed files with 103 additions and 1 deletions

View file

@ -905,7 +905,10 @@ Unsafe_DefineAnonymousClass_impl(JNIEnv *env,
}
const Klass* host_klass = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(host_class));
assert(host_klass != NULL, "invariant");
// Primitive types have NULL Klass* fields in their java.lang.Class instances.
if (host_klass == NULL) {
THROW_0(vmSymbols::java_lang_IllegalArgumentException());
}
const char* host_source = host_klass->external_name();
Handle host_loader(THREAD, host_klass->class_loader());