On Wed, 5 Aug 2026 10:53:01 GMT, Per Minborg <[email protected]> wrote:

>> This PR proposes to introduce checks for multiplication overflow in 
>> `SequenceLayoutImpl`. 
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Per Minborg has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Add mising check

src/java.base/share/classes/jdk/internal/foreign/layout/SequenceLayoutImpl.java 
line 181:

> 179:         MemoryLayout elemLayout = elementLayout();
> 180:         while (elemLayout instanceof SequenceLayoutImpl elemSeq) {
> 181:             count = count * elemSeq.elementCount();

This change probably also needs to be done here in `SequenceLayout​::flatten()`:
Suggestion:

            count = Math.multiplyExact(count, elemSeq.elementCount());

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

PR Review Comment: https://git.openjdk.org/jdk/pull/32191#discussion_r3724819679

Reply via email to