Affects: 6.0.11


The method setNativeBuffer in DefaultDataBuffer has follow implementation:

private void setNativeBuffer(ByteBuffer byteBuffer) {
        this.byteBuffer = byteBuffer;
        this.capacity = byteBuffer.remaining();
}

this.capacity will be returned by the capacity() method. The capacity shows how much data (bytes) this buffer can hold, this.capacity is used in many places in computations of limits.

It should be:

private void setNativeBuffer(ByteBuffer byteBuffer) {
        this.byteBuffer = byteBuffer;
        this.capacity = byteBuffer.capacity();
}

Comment From: poutsma

Thanks for spotting this bug. As with #30967, this fix breaks backward compatibility so I've scheduled it for 6.2.