From 16bb31c35dbb97862c2e15ba0e0f395647307ca5 Mon Sep 17 00:00:00 2001 From: kamg Date: Tue, 26 Oct 2010 14:08:49 -0400 Subject: [PATCH] 6891959: HotSpot should not throw ClassFormatError if a class has a field with '>' and/or '<' in its name Summary: Class file parser needs to look for and disallow '[' in names. Reviewed-by: coleenp, never --- src/share/vm/classfile/classFileParser.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/share/vm/classfile/classFileParser.cpp b/src/share/vm/classfile/classFileParser.cpp index a8de5afc5..b86e9fa89 100644 --- a/src/share/vm/classfile/classFileParser.cpp +++ b/src/share/vm/classfile/classFileParser.cpp @@ -4309,20 +4309,21 @@ int ClassFileParser::verify_legal_method_signature(symbolHandle name, symbolHand } -// Unqualified names may not contain the characters '.', ';', or '/'. -// Method names also may not contain the characters '<' or '>', unless or . -// Note that method names may not be or in this method. -// Because these names have been checked as special cases before calling this method -// in verify_legal_method_name. -bool ClassFileParser::verify_unqualified_name(char* name, unsigned int length, int type) { +// Unqualified names may not contain the characters '.', ';', '[', or '/'. +// Method names also may not contain the characters '<' or '>', unless +// or . Note that method names may not be or in this +// method. Because these names have been checked as special cases before +// calling this method in verify_legal_method_name. +bool ClassFileParser::verify_unqualified_name( + char* name, unsigned int length, int type) { jchar ch; for (char* p = name; p != name + length; ) { ch = *p; if (ch < 128) { p++; - if (ch == '.' || ch == ';') { - return false; // do not permit '.' or ';' + if (ch == '.' || ch == ';' || ch == '[' ) { + return false; // do not permit '.', ';', or '[' } if (type != LegalClass && ch == '/') { return false; // do not permit '/' unless it's class name -- GitLab