RFR: 8308549: Classfile API should fail to generate over-sized Code attribute [v2]

Jaikiran Pai jpai at openjdk.org
Wed May 24 13:52:57 UTC 2023


On Wed, 24 May 2023 12:57:59 GMT, Adam Sotona <asotona at openjdk.org> wrote:

>> src/java.base/share/classes/jdk/internal/classfile/impl/DirectCodeBuilder.java line 314:
>> 
>>> 312: 
>>> 313:                 int codeLength = curPc();
>>> 314:                 if (codeLength >= 65536) {
>> 
>> Hello Adam, looking at the JVM spec, section 4.7.3 https://docs.oracle.com/javase/specs/jvms/se17/html/jvms-4.html#jvms-4.7.3, it states:
>> 
>>> The value of code_length must be greater than zero (as the code array must not be empty) and less than 65536. 
>> 
>> Do you think this check then should also verify (and throw) if the codeLength <= 0?
>
> Right, DirectCodeBuilder can be triggered empty, thanks.

Thank you Adam for the update, looks good to me.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/14100#discussion_r1204181523


More information about the core-libs-dev mailing list