-
Notifications
You must be signed in to change notification settings - Fork 38.9k
Closed
Closed
Copy link
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: bugA general bugA general bug
Milestone
Description
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);
}injae-kim
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: bugA general bugA general bug