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

Update connection.js #35

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

Conversation

aleksraiden
Copy link

Fix Varint decode failing, if buffer empty (1 byte length). Minimal valid command length = 3

Fix Varint decode failing, if buffer empty (1 byte length). Minimal valid command length = 3
@mappum
Copy link
Contributor

mappum commented Mar 18, 2019

Hey @aleksraiden, thanks for the PR.

I'd like to see a test case for this. And can you elaborate more on the rationale? It seems to me that if the client or server is sending empty buffers with a 1-byte varint, we should still be consuming them from the stream instead of waiting to do it with more data.

@aleksraiden
Copy link
Author

As i see, this is "geithenbug". If i connect and read blocks, randomly, i have exception and abci app stop and exit. Yes, any byte at buffer must be checked for valid command, but in this case ve have rangeexception inside the protobuf decoder and then error was propagated to error handler and connection closed. Maybe other solution - return on maybeReadNextMessage if buffer has length == 1, before any varint.decode (today this is first line at fn).

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.

None yet

3 participants