mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 19:14:38 +02:00
7171703: JNI DefineClass crashes client VM when first parameter is NULL
Reviewed-by: acorn, kamg, sspitsyn, dholmes
This commit is contained in:
parent
1ac7879229
commit
911dcf0f08
1 changed files with 3 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -378,6 +378,7 @@ JNI_ENTRY(jclass, jni_DefineClass(JNIEnv *env, const char *name, jobject loaderR
|
|||
jclass cls = NULL;
|
||||
DT_RETURN_MARK(DefineClass, jclass, (const jclass&)cls);
|
||||
|
||||
TempNewSymbol class_name = NULL;
|
||||
// Since exceptions can be thrown, class initialization can take place
|
||||
// if name is NULL no check for class name in .class stream has to be made.
|
||||
if (name != NULL) {
|
||||
|
@ -387,9 +388,8 @@ JNI_ENTRY(jclass, jni_DefineClass(JNIEnv *env, const char *name, jobject loaderR
|
|||
// into the constant pool.
|
||||
THROW_MSG_0(vmSymbols::java_lang_NoClassDefFoundError(), name);
|
||||
}
|
||||
class_name = SymbolTable::new_symbol(name, CHECK_NULL);
|
||||
}
|
||||
TempNewSymbol class_name = SymbolTable::new_symbol(name, THREAD);
|
||||
|
||||
ResourceMark rm(THREAD);
|
||||
ClassFileStream st((u1*) buf, bufLen, NULL);
|
||||
Handle class_loader (THREAD, JNIHandles::resolve(loaderRef));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue