JDK-6930576 : classfile format checker allows invalid descriptor in CONSTANT_NameAndType_info [invokedynamic]
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2010-02-27
  • Updated: 2012-03-22
  • Resolved: 2010-10-22
Related Reports
Duplicate :  
Relates :  
Description
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
(according to JVMS Section 4.3.3) method descriptors at the descriptor_index
in the CONSTANT_NameAndType_info structure (like "()V;", "(.)V", "(;)V",
"()V#" or similar) when there is a reference to this NameAndType from
the 'invokedynamic' bytecode instruction.