RFR (XS) JDK-8041918: BootstrapMethods attribute cannot be empty
Lois Foltan
lois.foltan at oracle.com
Fri May 9 14:51:00 UTC 2014
On 5/9/2014 10:27 AM, harold seigel wrote:
> Hi Lois,
>
> Could TestEmptyBootstrapMethodsAttr.java, just check for
> "java.lang.ClassFormatError"? Then the test would not break if the
> rest of the message changed.
Hi Harold,
Thanks for the review. I can do that, but would prefer not to. It
allows the test to verify specifically the boundary condition of an
attribute_length of 2. If the message is changed in the future, it
would be pretty obvious why the test is failing.
>
> I think the .jcod files need copyright statements. Also, could you
> add a small comment about what each one does.
Will do.
Lois
>
> 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