mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8246729: MappedByteBuffer.force() throws IndexOutOfBoundsException
Reviewed-by: psandoz, alanb
This commit is contained in:
parent
63ade9c49c
commit
1786701011
2 changed files with 35 additions and 15 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -223,11 +223,9 @@ public abstract class MappedByteBuffer
|
|||
if (fd == null) {
|
||||
return this;
|
||||
}
|
||||
if (isSync) {
|
||||
return force(0, limit());
|
||||
}
|
||||
if ((address != 0) && (capacity() != 0)) {
|
||||
return force(0, capacity());
|
||||
int limit = limit();
|
||||
if (isSync || ((address != 0) && (limit != 0))) {
|
||||
return force(0, limit);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
@ -278,9 +276,10 @@ public abstract class MappedByteBuffer
|
|||
if (fd == null) {
|
||||
return this;
|
||||
}
|
||||
if ((address != 0) && (limit() != 0)) {
|
||||
int limit = limit();
|
||||
if ((address != 0) && (limit != 0)) {
|
||||
// check inputs
|
||||
Objects.checkFromIndexSize(index, length, limit());
|
||||
Objects.checkFromIndexSize(index, length, limit);
|
||||
MappedMemoryUtils.force(fd, address, isSync, index, length);
|
||||
}
|
||||
return this;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue