mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8289228: SegmentAllocator::allocateArray null handling is too lax
Reviewed-by: jvernee, psandoz
This commit is contained in:
parent
b4490386fe
commit
adbd200dc5
2 changed files with 3 additions and 16 deletions
|
@ -282,8 +282,9 @@ public interface SegmentAllocator {
|
|||
|
||||
private <Z> MemorySegment copyArrayWithSwapIfNeeded(Z array, ValueLayout elementLayout,
|
||||
Function<Z, MemorySegment> heapSegmentFactory) {
|
||||
Objects.requireNonNull(array);
|
||||
Objects.requireNonNull(elementLayout);
|
||||
int size = array == null ? 0 : Array.getLength(array);
|
||||
int size = Array.getLength(array);
|
||||
MemorySegment addr = allocateArray(elementLayout, size);
|
||||
if (size > 0) {
|
||||
MemorySegment.copy(heapSegmentFactory.apply(array), elementLayout, 0,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue