JDK-6901306 : classfile format checker permits array descriptor of more than 255 dims in CONSTANT_NameAndType_info
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 7
  • Priority: P2
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2009-11-13
  • Updated: 2011-01-19
  • Resolved: 2010-09-03
Related Reports
Duplicate :  
Relates :  
Description
Draft JVMS 3ed specifies the requirements on array type descriptors in 4.3.2
section:
  ---Excerpt-from-spec---
  A type descriptor representing an array type is valid only if it represents a
  type with *255 or fewer dimensions*.
  ---End-of-excerpt---

JVMS section 4.4.6 states as follows:
  ---Excerpt-from-spec---
  CONSTANT_NameAndType_info {
    u1 tag;
    u2 name_index;
    u2 descriptor_index;
  }
  ...
  The items of the CONSTANT_NameAndType_info structure are as follows:
  ...
  descriptor_index

  The value of the descriptor_index item must be a valid index into the
  constant_pool table. The constant_pool entry at that index must be a
  CONSTANT_Utf8_info (4.4.7) structure representing a *valid* field descriptor
  (4.3.2) or method descriptor (4.3.3).
  ---End-of-excerpt---

However, JVM class format checker does not reject classes with invalid (more
than 255 dimensions) array type descriptors at the descriptor_index in the 
CONSTANT_NameAndType_info structure.

Comments
EVALUATION This was fixed by the fix for 6930553. I'll close this one as a dup of that. Like the referenced bug, the more restrictive behavior is enforced only upon classfiles with version >= 51 to ensure backwards compatibility. The test will have to be modified to use a classfile version 51 in order to verify this fix.
03-09-2010