-
Notifications
You must be signed in to change notification settings - Fork 504
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
Fix Wrongly parsed the RESP empty/null array #652
Conversation
Cool, can you add some test cases in protocol.tcl to make sure it has already fixed? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with @git-hulk, the rest looks good. Thanks for contribution.
} catch (std::exception &e) { | ||
free(line); | ||
return Status(Status::NotOK, "Protocol error: invalid multibulk length"); | ||
} | ||
if (multi_bulk_len_ <= 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is an assignment multi_bulk_len_ = 0
needed while the condition multi_bulk_len_ < 0
holds?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a condition if (multi_bulk_len_ == 0)
in src/redis_request.cc:111
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
state_
is still ArrayLen
, so it will read again and assign to multi_bulk_len_
. it's a good habit that to add the assignment multi_bulk_len_ = 0
. Thank you
sure, that's what i should do. |
Cool, thanks @willshS |
Shall this patch fix #633? |
yes |
This closes #633.
Now : I only fix like:
echo -e '*-1\r\n*2\r\n$3\r\nget\r\n$3\r\nkey\r\n' | nc 127.0.0.1 6666
echo -e '*2\r\n$3\r\nget\r\n$3\r\nkey\r\n*0\r\n*2\r\n$3\r\nget\r\n$3\r\nkey\r\n' | nc 127.0.0.1 6666
Redis can have "nil" value. like:
kvrocks also behaves the same way.(I didn't modify anything about "nil" value)