8276241: JVM does not flag constant class entries ending in '/'

Reviewed-by: dholmes, lfoltan
This commit is contained in:
Harold Seigel 2021-12-13 13:40:54 +00:00
parent 14f7385a72
commit 15996e4075
2 changed files with 86 additions and 3 deletions

View file

@ -4529,7 +4529,6 @@ void ClassFileParser::verify_legal_class_modifiers(jint flags, TRAPS) const {
const bool is_enum = (flags & JVM_ACC_ENUM) != 0;
const bool is_annotation = (flags & JVM_ACC_ANNOTATION) != 0;
const bool major_gte_1_5 = _major_version >= JAVA_1_5_VERSION;
const bool major_gte_14 = _major_version >= JAVA_14_VERSION;
if ((is_abstract && is_final) ||
(is_interface && !is_abstract) ||
@ -4785,7 +4784,7 @@ bool ClassFileParser::verify_unqualified_name(const char* name,
// Take pointer to a UTF8 byte string (not NUL-terminated).
// Skip over the longest part of the string that could
// be taken as a fieldname. Allow '/' if slash_ok is true.
// be taken as a fieldname. Allow non-trailing '/'s if slash_ok is true.
// Return a pointer to just past the fieldname.
// Return NULL if no fieldname at all was found, or in the case of slash_ok
// being true, we saw consecutive slashes (meaning we were looking for a
@ -4859,7 +4858,7 @@ static const char* skip_over_field_name(const char* const name,
}
return (not_first_ch) ? old_p : NULL;
}
return (not_first_ch) ? p : NULL;
return (not_first_ch && !last_is_slash) ? p : NULL;
}
// Take pointer to a UTF8 byte string (not NUL-terminated).