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

harold seigel harold.seigel at oracle.com
Fri May 9 14:27:34 UTC 2014


Hi Lois,

Could TestEmptyBootstrapMethodsAttr.java, just check for 
"java.lang.ClassFormatError"?  Then the test would not break if the rest 
of the message changed.

I think the .jcod files need copyright statements.  Also, could you add 
a small comment about what each one does.

Thanks, Harold

On 5/9/2014 10:22 AM, Lois Foltan wrote:
> Hello,
>
> Please review the following fix:
>
> Webrev:
>     http://cr.openjdk.java.net/~lfoltan/bug_jdk8041918/
>
> Bug: BootstrapMethods attribute cannot be empty
>     https://bugs.openjdk.java.net/browse/JDK-8041918
>
> 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.
>
> Tests:
>     Hotspot's jtreg tests, JCK lang & vm, JDK lang & util, 
> vm.quick.testlist
>
> Thank you,
> Lois



More information about the hotspot-runtime-dev mailing list