On Tue, 4 Aug 2026 15:15:45 GMT, Chen Liang <[email protected]> wrote:

>> This internal endpoint used only by trusted code is missing bound checks. 
>> Since this endpoint leads to direct unsafe usage, we should better gatekeep 
>> here.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Chen Liang has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Negative value

Marked as reviewed by vyazici (Reviewer).

src/java.base/share/classes/jdk/internal/classfile/impl/RawBytecodeHelper.java 
line 253:

> 251:             // Don't use IAE formatter - this length comes from 
> implementation, any
> 252:             // out-of-bounds is an implementation defect instead of a 
> user error
> 253:             Preconditions.checkIndex(length, array.length + 1, 
> Preconditions.AIOOBE_FORMATTER);

*Nit:* I needed to scratch my head for the `+ 1` part. You might consider 
changing this to:

    checkFromIndexSize(0, length, array.length, ...)

It is also fine in its current form.

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

PR Review: https://git.openjdk.org/jdk/pull/32195#pullrequestreview-4856081722
PR Review Comment: https://git.openjdk.org/jdk/pull/32195#discussion_r3713806908

Reply via email to