RFR: 8364360: Defining hidden class with no room in constant pool crashes the VM [v6]
Coleen Phillimore
coleenp at openjdk.org
Fri Oct 31 19:15:26 UTC 2025
On Fri, 31 Oct 2025 18:53:38 GMT, Matias Saavedra Silva <matsaave at openjdk.org> wrote:
>> Coleen Phillimore has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Simplify the test.
>
> src/hotspot/share/classfile/classFileParser.cpp line 5529:
>
>> 5527: // Check for overflow. cp_size is a u2.
>> 5528: assert(sizeof(cp_size) == sizeof(u2), "this overflow test depends on this");
>> 5529: guarantee_property(cp_size > _orig_cp_size, "Overflow in constant pool size for hidden class %s", CHECK);
>
> Isn't this technically UB behavior? It isn't guaranteed that a u2 will overflow to a low value. It might be safer have cp_size be an int and then guarantee that cp_size < 65535.
Doing a cast to u4 and an overflow check might be the best thing. Then I won't need the assert.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27964#discussion_r2482441449
More information about the hotspot-runtime-dev
mailing list