33 #include <stdlib.h> |
33 #include <stdlib.h> |
34 |
34 |
35 #include "jni.h" |
35 #include "jni.h" |
36 #include "jni_util.h" |
36 #include "jni_util.h" |
37 #include "jvm.h" |
37 #include "jvm.h" |
|
38 #include "check_classname.h" |
38 #include "java_lang_Class.h" |
39 #include "java_lang_Class.h" |
39 |
|
40 /* defined in libverify.so/verify.dll (src file common/check_format.c) */ |
|
41 extern jboolean VerifyClassname(char *utf_name, jboolean arrayAllowed); |
|
42 extern jboolean VerifyFixClassname(char *utf_name); |
|
43 |
40 |
44 #define OBJ "Ljava/lang/Object;" |
41 #define OBJ "Ljava/lang/Object;" |
45 #define CLS "Ljava/lang/Class;" |
42 #define CLS "Ljava/lang/Class;" |
46 #define CPL "Ljdk/internal/reflect/ConstantPool;" |
43 #define CPL "Ljdk/internal/reflect/ConstantPool;" |
47 #define STR "Ljava/lang/String;" |
44 #define STR "Ljava/lang/String;" |
74 {"desiredAssertionStatus0","("CLS")Z", (void *)&JVM_DesiredAssertionStatus}, |
71 {"desiredAssertionStatus0","("CLS")Z", (void *)&JVM_DesiredAssertionStatus}, |
75 {"getEnclosingMethod0", "()[" OBJ, (void *)&JVM_GetEnclosingMethodInfo}, |
72 {"getEnclosingMethod0", "()[" OBJ, (void *)&JVM_GetEnclosingMethodInfo}, |
76 {"getRawTypeAnnotations", "()" BA, (void *)&JVM_GetClassTypeAnnotations}, |
73 {"getRawTypeAnnotations", "()" BA, (void *)&JVM_GetClassTypeAnnotations}, |
77 {"getNestHost0", "()" CLS, (void *)&JVM_GetNestHost}, |
74 {"getNestHost0", "()" CLS, (void *)&JVM_GetNestHost}, |
78 {"getNestMembers0", "()[" CLS, (void *)&JVM_GetNestMembers}, |
75 {"getNestMembers0", "()[" CLS, (void *)&JVM_GetNestMembers}, |
|
76 {"linkClass", "(" CLS ")V", (void *)&JVM_LinkClass}, |
79 }; |
77 }; |
80 |
78 |
81 #undef OBJ |
79 #undef OBJ |
82 #undef CLS |
80 #undef CLS |
83 #undef STR |
81 #undef STR |
120 } else { |
118 } else { |
121 clname = buf; |
119 clname = buf; |
122 } |
120 } |
123 (*env)->GetStringUTFRegion(env, classname, 0, unicode_len, clname); |
121 (*env)->GetStringUTFRegion(env, classname, 0, unicode_len, clname); |
124 |
122 |
125 if (VerifyFixClassname(clname) == JNI_TRUE) { |
123 if (verifyFixClassname(clname) == JNI_TRUE) { |
126 /* slashes present in clname, use name b4 translation for exception */ |
124 /* slashes present in clname, use name b4 translation for exception */ |
127 (*env)->GetStringUTFRegion(env, classname, 0, unicode_len, clname); |
125 (*env)->GetStringUTFRegion(env, classname, 0, unicode_len, clname); |
128 JNU_ThrowClassNotFoundException(env, clname); |
126 JNU_ThrowClassNotFoundException(env, clname); |
129 goto done; |
127 goto done; |
130 } |
128 } |
131 |
129 |
132 if (!VerifyClassname(clname, JNI_TRUE)) { /* expects slashed name */ |
130 if (!verifyClassname(clname, JNI_TRUE)) { /* expects slashed name */ |
133 JNU_ThrowClassNotFoundException(env, clname); |
131 JNU_ThrowClassNotFoundException(env, clname); |
134 goto done; |
132 goto done; |
135 } |
133 } |
136 |
134 |
137 cls = JVM_FindClassFromCaller(env, clname, initialize, loader, caller); |
135 cls = JVM_FindClassFromCaller(env, clname, initialize, loader, caller); |