< prev index next >

src/hotspot/share/classfile/classFileParser.cpp

Print this page

        

*** 653,663 **** sig_index, CHECK); guarantee_property(name->utf8_length() != 0, "Illegal zero length constant pool entry at %d in class %s", name_index, CHECK); ! if (sig->byte_at(0) == JVM_SIGNATURE_FUNC) { // Format check method name and signature verify_legal_method_name(name, CHECK); verify_legal_method_signature(name, sig, CHECK); } else { // Format check field name and signature --- 653,663 ---- sig_index, CHECK); guarantee_property(name->utf8_length() != 0, "Illegal zero length constant pool entry at %d in class %s", name_index, CHECK); ! if (sig->char_at(0) == JVM_SIGNATURE_FUNC) { // Format check method name and signature verify_legal_method_name(name, CHECK); verify_legal_method_signature(name, sig, CHECK); } else { // Format check field name and signature
*** 680,690 **** const Symbol* const signature = cp->symbol_at(signature_ref_index); if (_need_verify) { // CONSTANT_Dynamic's name and signature are verified above, when iterating NameAndType_info. // Need only to be sure signature is non-zero length and the right type. if (signature->utf8_length() == 0 || ! signature->byte_at(0) == JVM_SIGNATURE_FUNC) { throwIllegalSignature("CONSTANT_Dynamic", name, signature, CHECK); } } break; } --- 680,690 ---- const Symbol* const signature = cp->symbol_at(signature_ref_index); if (_need_verify) { // CONSTANT_Dynamic's name and signature are verified above, when iterating NameAndType_info. // Need only to be sure signature is non-zero length and the right type. if (signature->utf8_length() == 0 || ! signature->char_at(0) == JVM_SIGNATURE_FUNC) { throwIllegalSignature("CONSTANT_Dynamic", name, signature, CHECK); } } break; }
*** 705,732 **** if (tag == JVM_CONSTANT_Fieldref) { if (_need_verify) { // Field name and signature are verified above, when iterating NameAndType_info. // Need only to be sure signature is non-zero length and the right type. if (signature->utf8_length() == 0 || ! signature->byte_at(0) == JVM_SIGNATURE_FUNC) { throwIllegalSignature("Field", name, signature, CHECK); } } } else { if (_need_verify) { // Method name and signature are verified above, when iterating NameAndType_info. // Need only to be sure signature is non-zero length and the right type. if (signature->utf8_length() == 0 || ! signature->byte_at(0) != JVM_SIGNATURE_FUNC) { throwIllegalSignature("Method", name, signature, CHECK); } } // 4509014: If a class method name begins with '<', it must be "<init>" const unsigned int name_len = name->utf8_length(); if (tag == JVM_CONSTANT_Methodref && name_len != 0 && ! name->byte_at(0) == '<' && name != vmSymbols::object_initializer_name()) { classfile_parse_error( "Bad method name at constant pool index %u in class file %s", name_ref_index, CHECK); } --- 705,732 ---- if (tag == JVM_CONSTANT_Fieldref) { if (_need_verify) { // Field name and signature are verified above, when iterating NameAndType_info. // Need only to be sure signature is non-zero length and the right type. if (signature->utf8_length() == 0 || ! signature->char_at(0) == JVM_SIGNATURE_FUNC) { throwIllegalSignature("Field", name, signature, CHECK); } } } else { if (_need_verify) { // Method name and signature are verified above, when iterating NameAndType_info. // Need only to be sure signature is non-zero length and the right type. if (signature->utf8_length() == 0 || ! signature->char_at(0) != JVM_SIGNATURE_FUNC) { throwIllegalSignature("Method", name, signature, CHECK); } } // 4509014: If a class method name begins with '<', it must be "<init>" const unsigned int name_len = name->utf8_length(); if (tag == JVM_CONSTANT_Methodref && name_len != 0 && ! name->char_at(0) == '<' && name != vmSymbols::object_initializer_name()) { classfile_parse_error( "Bad method name at constant pool index %u in class file %s", name_ref_index, CHECK); }
*** 940,950 **** } else { Symbol* const unresolved_klass = cp->klass_name_at(interface_index); // Don't need to check legal name because it's checked when parsing constant pool. // But need to make sure it's not an array type. ! guarantee_property(unresolved_klass->byte_at(0) != JVM_SIGNATURE_ARRAY, "Bad interface name in class file %s", CHECK); // Call resolve_super so classcircularity is checked interf = SystemDictionary::resolve_super_or_fail( _class_name, --- 940,950 ---- } else { Symbol* const unresolved_klass = cp->klass_name_at(interface_index); // Don't need to check legal name because it's checked when parsing constant pool. // But need to make sure it's not an array type. ! guarantee_property(unresolved_klass->char_at(0) != JVM_SIGNATURE_ARRAY, "Bad interface name in class file %s", CHECK); // Call resolve_super so classcircularity is checked interf = SystemDictionary::resolve_super_or_fail( _class_name,
*** 3750,3760 **** if (cp->tag_at(super_class_index).is_klass()) { super_klass = InstanceKlass::cast(cp->resolved_klass_at(super_class_index)); if (need_verify) is_array = super_klass->is_array_klass(); } else if (need_verify) { ! is_array = (cp->klass_name_at(super_class_index)->byte_at(0) == JVM_SIGNATURE_ARRAY); } if (need_verify) { guarantee_property(!is_array, "Bad superclass name in class file %s", CHECK_NULL); } --- 3750,3760 ---- if (cp->tag_at(super_class_index).is_klass()) { super_klass = InstanceKlass::cast(cp->resolved_klass_at(super_class_index)); if (need_verify) is_array = super_klass->is_array_klass(); } else if (need_verify) { ! is_array = (cp->klass_name_at(super_class_index)->char_at(0) == JVM_SIGNATURE_ARRAY); } if (need_verify) { guarantee_property(!is_array, "Bad superclass name in class file %s", CHECK_NULL); }
*** 5377,5387 **** nextp = skip_over_field_signature(p, false, length, CHECK_0); } // The first non-signature thing better be a ')' if ((length > 0) && (*p++ == JVM_SIGNATURE_ENDFUNC)) { length--; ! if (name->utf8_length() > 0 && name->byte_at(0) == '<') { // All internal methods must return void if ((length == 1) && (p[0] == JVM_SIGNATURE_VOID)) { return args_size; } } else { --- 5377,5387 ---- nextp = skip_over_field_signature(p, false, length, CHECK_0); } // The first non-signature thing better be a ')' if ((length > 0) && (*p++ == JVM_SIGNATURE_ENDFUNC)) { length--; ! if (name->utf8_length() > 0 && name->char_at(0) == '<') { // All internal methods must return void if ((length == 1) && (p[0] == JVM_SIGNATURE_VOID)) { return args_size; } } else {
*** 5794,5804 **** // host's package. If the classes are in different packages then throw an IAE // exception. void ClassFileParser::fix_unsafe_anonymous_class_name(TRAPS) { assert(_unsafe_anonymous_host != NULL, "Expected an unsafe anonymous class"); ! const jbyte* anon_last_slash = UTF8::strrchr(_class_name->base(), _class_name->utf8_length(), '/'); if (anon_last_slash == NULL) { // Unnamed package prepend_host_package_name(_unsafe_anonymous_host, CHECK); } else { if (!_unsafe_anonymous_host->is_same_class_package(_unsafe_anonymous_host->class_loader(), _class_name)) { --- 5794,5804 ---- // host's package. If the classes are in different packages then throw an IAE // exception. void ClassFileParser::fix_unsafe_anonymous_class_name(TRAPS) { assert(_unsafe_anonymous_host != NULL, "Expected an unsafe anonymous class"); ! const jbyte* anon_last_slash = UTF8::strrchr((const jbyte*)_class_name->base(), _class_name->utf8_length(), '/'); if (anon_last_slash == NULL) { // Unnamed package prepend_host_package_name(_unsafe_anonymous_host, CHECK); } else { if (!_unsafe_anonymous_host->is_same_class_package(_unsafe_anonymous_host->class_loader(), _class_name)) {
*** 6117,6127 **** // Don't need to check whether this class name is legal or not. // It has been checked when constant pool is parsed. // However, make sure it is not an array type. if (_need_verify) { ! guarantee_property(_class_name->byte_at(0) != JVM_SIGNATURE_ARRAY, "Bad class name in class file %s", CHECK); } // Checks if name in class file matches requested name --- 6117,6127 ---- // Don't need to check whether this class name is legal or not. // It has been checked when constant pool is parsed. // However, make sure it is not an array type. if (_need_verify) { ! guarantee_property(_class_name->char_at(0) != JVM_SIGNATURE_ARRAY, "Bad class name in class file %s", CHECK); } // Checks if name in class file matches requested name
< prev index next >