Affects: 6.0.11
The class DefaultDataBuffer has method getNativeBuffer with follow implementation:
public ByteBuffer getNativeBuffer() {
this.byteBuffer.position(this.readPosition);
this.byteBuffer.limit(readableByteCount());
return this.byteBuffer;
}
@Override
public int readableByteCount() {
return this.writePosition - this.readPosition;
}
The limit of the byte buffer to return should be set to the this.writePosition, because if the condition (this.writePosition - this.readPosition) <= this.readPosition is satisfied, the limit of the returned byte buffer will be equal to its current position, so no single byte could be read from this buffer, even if the condition this.writePosition > this.readPosition is satisfied. So how it should be:
public ByteBuffer getNativeBuffer() {
return this.byteBuffer.limit(this.writePosition).position(this.readPosition);
}
Affects: 6.0.11
The class
DefaultDataBufferhas methodgetNativeBufferwith follow implementation:The limit of the byte buffer to return should be set to the
this.writePosition, because if the condition(this.writePosition - this.readPosition) <= this.readPositionis satisfied, the limit of the returned byte buffer will be equal to its current position, so no single byte could be read from this buffer, even if the conditionthis.writePosition > this.readPositionis satisfied. So how it should be: