8225789: Empty method parameter type should generate ClassFormatError

Check for an empty name when verifying unqualified names

Reviewed-by: lfoltan, coleenp
This commit is contained in:
Harold Seigel 2019-06-19 08:42:15 -04:00
parent 9b2f151f30
commit b304a57980
4 changed files with 92 additions and 2 deletions

View file

@ -4956,6 +4956,7 @@ void ClassFileParser::verify_legal_utf8(const unsigned char* buffer,
bool ClassFileParser::verify_unqualified_name(const char* name,
unsigned int length,
int type) {
if (length == 0) return false; // Must have at least one char.
for (const char* p = name; p != name + length; p++) {
switch(*p) {
case '.':
@ -5105,7 +5106,7 @@ const char* ClassFileParser::skip_over_field_signature(const char* signature,
int newlen = c - (char*) signature;
bool legal = verify_unqualified_name(signature, newlen, LegalClass);
if (!legal) {
classfile_parse_error("Class name contains illegal character "
classfile_parse_error("Class name is empty or contains illegal character "
"in descriptor in class file %s",
CHECK_0);
return NULL;