RFR (XS) JDK-8041918: BootstrapMethods attribute cannot be empty

Lois Foltan lois.foltan at oracle.com
Fri May 9 14:22:13 UTC 2014


Please review the following fix:


Bug: BootstrapMethods attribute cannot be empty

Summary of fix:
JVMS 8, section 4.7.23 details the BootstrapMethods attribute. In 
particular, page 155, describes the "attribute length" field of a 
BootstrapMethods attribute by documenting, "the value of the 
attribute_length item indicates the length of the attribute, excluding 
the initial six bytes."  Thus, a valid BootstrapMethod attribute could 
have an empty bootstrap_methods table where the num_bootstrap_methods 
field is equal to zero.  This situation would set the attribute_length 
legitimately to 2.  The class format check within 
ClassFileParser::parse_classfile_bootstrap_methods_attribte() must check 
for attribute_byte_length to be greater than or equal to the sizeof(u2). 
This check was added post JDK 8, an empty bootstrap_methods table was 
accepted by JDK 8 without generating a ClassFormatError.  Thank you to 
Harold Seigel for helping to figure out the .jcod files to yield a 
reproducer for this bug.

     Hotspot's jtreg tests, JCK lang & vm, JDK lang & util, 

Thank you,

More information about the hotspot-runtime-dev mailing list