-
Notifications
You must be signed in to change notification settings - Fork 38.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The method getNativeBuffer() in DefaultDataBuffer returns misconfigured ByteBuffer #30967
Comments
Thanks for reporting the issue. We'll look into it. |
I create fix PR #32009 with test~! 😃 |
getNativeBuffer()
in DefaultDataBuffer
returns misconfigured ByteBuffer
You are correct, this is a bug. It does not seem to occur much because the read position is typically 0. Even though this is a bug fix, it is a breaking change and breaks backward compatibility and therefore I am scheduling it for 6.2. |
getNativeBuffer()
in DefaultDataBuffer
returns misconfigured ByteBuffer
It seems that this or #30967 needs to be superseded not to have two entries for the same in the milestone or the release notes. |
Affects: 6.0.11
The class
DefaultDataBuffer
has methodgetNativeBuffer
with 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.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 conditionthis.writePosition > this.readPosition
is satisfied. So how it should be:The text was updated successfully, but these errors were encountered: