-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Pad encData to 17 bytes before decoding #4066
Conversation
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.
✅ A review job has been created and sent to the PullRequest network.
@animesh2049 you can click here to see the review status or cancel the code review job.
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.
Looks good to me. I'd recommend moving 17 into a variable with a descriptive name or comment, especially since it's now used in two places. But no biggie either way
Reviewed with ❤️ by PullRequest
Might want to note this is to workaround dgryski/go-groupvarint#1 |
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.
Reviewed 1 of 1 files at r1.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @animesh2049 and @manishrjain)
codec/codec.go, line 142 at r1 (raw file):
// decoding and expects it to be of length >= 4 at all the stages. Padding // with zero to make sure length is always >= 4. encData = append(encData, bytes.Repeat([]byte{0}, 17-len(encData))...)
What happens if len(encData) is greater than 17? I am assuming nothing is appended. If that's the case, feel free to resolve this issue.
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.
Can you please add dgryski/go-groupvarint#1 in a comment above the padding. Also, in our chat, I had asked to add a comment about the number 17s significance. So, please do that as well.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @animesh2049 and @manishrjain)
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.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @martinmr)
codec/codec.go, line 142 at r1 (raw file):
Previously, martinmr (Martin Martinez Rivera) wrote…
What happens if len(encData) is greater than 17? I am assuming nothing is appended. If that's the case, feel free to resolve this issue.
Yes.
Fixes #4020
We tried to reproduce the issue.
Setup
Linux
Windows
This change is