[jdk19] RFR: 8289365: SegmentAllocator:allocateArray(MemoryLayout, count) does not throw IAEx when count is -1

Maurizio Cimadamore mcimadamore at openjdk.org
Mon Jul 11 14:53:18 UTC 2022


The default implementation for `SegmentAllocator:allocateArray(MemoryLayout, count)` is missing a check for negative array size.
In the past this used to be caught in the `SequenceLayout` factory, but not anymore, as now `SequenceLayout` accepts `-1` as special size where the sequence element count is inferred. So, an explicit check is needed.

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

Commit messages:
 - Initial push

Changes: https://git.openjdk.org/jdk19/pull/132/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk19&pr=132&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8289365
  Stats: 8 lines in 2 files changed: 8 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jdk19/pull/132.diff
  Fetch: git fetch https://git.openjdk.org/jdk19 pull/132/head:pull/132

PR: https://git.openjdk.org/jdk19/pull/132


More information about the core-libs-dev mailing list