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

Fixed handling of empty byte arrays #430

Merged
merged 1 commit into from
Nov 16, 2017

Conversation

lutovich
Copy link
Contributor

Previously decoding of empty byte arrays caused an error because pack stream layer forced pack input to fill in an empty buffer. Later tried to fetch next chunk in such case and still fill the given buffer with nothing. This caused it to fail later on message boundary, when asserting that the whole chunk has been consumed.

This PR fixes the problem by making pack input do nothing when asked to fill in an empty buffer. It also adds a branch in pack stream to always return a single empty byte array and not even attempt to read.

Previously decoding of empty byte arrays caused an error because pack
stream layer forced pack input to fill in an empty buffer. Later tried
to fetch next chunk in such case and still fill the given buffer with
nothing. This caused it to fail later on message boundary, when
asserting that the whole chunk has been consumed.

This commit fixes the problem by making pack input do nothing when
asked to fill in an empty buffer. It also adds a branch in pack
stream to always return a single empty byte array and not even
attempt to read.
Copy link
Contributor

@zhenlineo zhenlineo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG, suggesting to also add tests for other drivers.

Copy link
Contributor

@ali-ince ali-ince left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ali-ince ali-ince merged commit 5c68377 into neo4j:1.4 Nov 16, 2017
@lutovich lutovich deleted the 1.4-empty-byte-array branch November 16, 2017 09:31
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.

3 participants