RFR: 8306959: (bf) CharBuffer.append(CharSequence, int, int) throws BufferOverflowException where IndexOutOfBoundsException expected

Brian Burkhalter bpb at openjdk.org
Wed Apr 26 23:02:57 UTC 2023


On Wed, 26 Apr 2023 22:48:19 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

> In `java.nio.CharBuffer::append(CharSequence csq, int start, int end)`, the `start` and `end` parameters need to be validated against the preconditions specified by `Appendable::append(CharSequence csq, int start, int end)` before they are used to determine whether a buffer overflow condition exists.

The requisite verification of the parameters was already being done for direct buffers using `Object::checkFromToIndex(start, end, cqs.length())` but is missing for heap and generic `X-Buffer`s.

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

PR Comment: https://git.openjdk.org/jdk/pull/13680#issuecomment-1524132540


More information about the nio-dev mailing list