Skip to content
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

Issue 4503: Added check into BufferedChannel's read to avoid endless loop #4506

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

StefanoBelli
Copy link

Fix #4503

Motivation

As discussed in the referred issue, this PR aims to avoid the endless loop which will happen if the dest ByteBuf passed to the BufferedChannel's read has less remaining writable bytes than the amount of bytes required to read (read's "length" parameter)

Changes

Now, BufferedChannel.read() throws an exception if dest. buf. writableBytes is less than length

… buffer's remaining capacity is not as much as length
@shoothzj
Copy link
Member

Thanks for your contribution. Could you please add a unit test for this change?

@StefanoBelli
Copy link
Author

Of course, I will add test cases to the existing BufferedChanelTests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BufferedChannel's read(ByteBuf, long, int) gets stuck in loop
3 participants