-
Notifications
You must be signed in to change notification settings - Fork 7.3k
ZOOKEEPER-4281: Allow packet of max packet length to be deserialized #1683
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
Conversation
|
@eolivelli @maoling @ztzg @hanm Could you help take a quick look and decide whether the PR is valid/helpful? Thank you! |
|
It makes sense to me |
arshadmohammad
left a comment
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.
LGTM +1
|
Thanks for the review, @eolivelli, @arshadmohammad. Failed CI checks don't seem related to this change. retest maven build |
eolivelli
left a comment
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.
Sorry for late reply.
Can you please add one unit test around the code you changed? In order to not introduce regressions in the future
@eolivelli Thanks for the suggestion. A unit test is added :) Could you take another look? |
eolivelli
left a comment
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.
Perfect
|
@eolivelli @arshadmohammad @maoling Is it fine to merge this PR? Let me know if there is anything else we should do before merging it. Thank you! |
|
I have restarted CI jobs, as soon as CI is green I will merge. |
@eolivelli thanks for triggering the checks. It seems a check (tests) timed out. From the previous merged PRs, the tests are not stable. It might need several retries to get all checks green :( |
|
I have restarted the CI job, we still have a few problems with GitHub actions and JDK11, sorry |
|
it looks like the link to GH actions diappeared btw this fix is save and main QA checks passed. |
### Problem Resolves https://issues.apache.org/jira/browse/ZOOKEEPER-4281 There are sanity checks for packet size when deserializing a packet. One place has the inclusion: len >= packetLen. It rejects to deserialize the bytes that are exactly sized jute.maxbuffer. It's confusing. This check should use ">" so the maxbuffer length packet can still be deserialized, like the other checks. ``` if (len < 0 || len >= packetLen) { throw new IOException("Packet len " + len + " is out of range!"); } ``` ### Solution Change: `len >= packetLen` -> `len > packetLen` ``` if (len < 0 || len > packetLen) { ``` Author: Huizhi Lu <5187721+pkuwm@users.noreply.github.com> Reviewers: Enrico Olivelli <eolivelli@apache.org>, Mohammad Arshad <arshad@apache.org>, Michael Han <hanm@apache.org> Closes #1683 from pkuwm/maxPacketLength (cherry picked from commit 1590a42) Signed-off-by: Enrico Olivelli <eolivelli@datastax.com>
|
committed to master branch (3.8.x) and to branch-3.7 (3.7.1) |
Resolves https://issues.apache.org/jira/browse/ZOOKEEPER-4281 There are sanity checks for packet size when deserializing a packet. One place has the inclusion: len >= packetLen. It rejects to deserialize the bytes that are exactly sized jute.maxbuffer. It's confusing. This check should use ">" so the maxbuffer length packet can still be deserialized, like the other checks. ``` if (len < 0 || len >= packetLen) { throw new IOException("Packet len " + len + " is out of range!"); } ``` Change: `len >= packetLen` -> `len > packetLen` ``` if (len < 0 || len > packetLen) { ``` Author: Huizhi Lu <5187721+pkuwm@users.noreply.github.com> Reviewers: Enrico Olivelli <eolivelli@apache.org>, Mohammad Arshad <arshad@apache.org>, Michael Han <hanm@apache.org> Closes apache#1683 from pkuwm/maxPacketLength
Resolves https://issues.apache.org/jira/browse/ZOOKEEPER-4281 There are sanity checks for packet size when deserializing a packet. One place has the inclusion: len >= packetLen. It rejects to deserialize the bytes that are exactly sized jute.maxbuffer. It's confusing. This check should use ">" so the maxbuffer length packet can still be deserialized, like the other checks. ``` if (len < 0 || len >= packetLen) { throw new IOException("Packet len " + len + " is out of range!"); } ``` Change: `len >= packetLen` -> `len > packetLen` ``` if (len < 0 || len > packetLen) { ``` Author: Huizhi Lu <5187721+pkuwm@users.noreply.github.com> Reviewers: Enrico Olivelli <eolivelli@apache.org>, Mohammad Arshad <arshad@apache.org>, Michael Han <hanm@apache.org> Closes apache#1683 from pkuwm/maxPacketLength
…48) ZOOKEEPER-4281: Allow packet of max packet length to be deserialized ### Problem Resolves https://issues.apache.org/jira/browse/ZOOKEEPER-4281 There are sanity checks for packet size when deserializing a packet. One place has the inclusion: len >= packetLen. It rejects to deserialize the bytes that are exactly sized jute.maxbuffer. It's confusing. This check should use ">" so the maxbuffer length packet can still be deserialized, like the other checks. ``` if (len < 0 || len >= packetLen) { throw new IOException("Packet len " + len + " is out of range!"); } ``` ### Solution Change: `len >= packetLen` -> `len > packetLen` ``` if (len < 0 || len > packetLen) { ``` Author: Huizhi Lu <5187721+pkuwm@users.noreply.github.com> Reviewers: Enrico Olivelli <eolivelli@apache.org>, Mohammad Arshad <arshad@apache.org>, Michael Han <hanm@apache.org> Closes apache#1683 from pkuwm/maxPacketLength
…48) ZOOKEEPER-4281: Allow packet of max packet length to be deserialized ### Problem Resolves https://issues.apache.org/jira/browse/ZOOKEEPER-4281 There are sanity checks for packet size when deserializing a packet. One place has the inclusion: len >= packetLen. It rejects to deserialize the bytes that are exactly sized jute.maxbuffer. It's confusing. This check should use ">" so the maxbuffer length packet can still be deserialized, like the other checks. ``` if (len < 0 || len >= packetLen) { throw new IOException("Packet len " + len + " is out of range!"); } ``` ### Solution Change: `len >= packetLen` -> `len > packetLen` ``` if (len < 0 || len > packetLen) { ``` Author: Huizhi Lu <5187721+pkuwm@users.noreply.github.com> Reviewers: Enrico Olivelli <eolivelli@apache.org>, Mohammad Arshad <arshad@apache.org>, Michael Han <hanm@apache.org> Closes apache#1683 from pkuwm/maxPacketLength
…48) ZOOKEEPER-4281: Allow packet of max packet length to be deserialized ### Problem Resolves https://issues.apache.org/jira/browse/ZOOKEEPER-4281 There are sanity checks for packet size when deserializing a packet. One place has the inclusion: len >= packetLen. It rejects to deserialize the bytes that are exactly sized jute.maxbuffer. It's confusing. This check should use ">" so the maxbuffer length packet can still be deserialized, like the other checks. ``` if (len < 0 || len >= packetLen) { throw new IOException("Packet len " + len + " is out of range!"); } ``` ### Solution Change: `len >= packetLen` -> `len > packetLen` ``` if (len < 0 || len > packetLen) { ``` Author: Huizhi Lu <5187721+pkuwm@users.noreply.github.com> Reviewers: Enrico Olivelli <eolivelli@apache.org>, Mohammad Arshad <arshad@apache.org>, Michael Han <hanm@apache.org> Closes apache#1683 from pkuwm/maxPacketLength
Problem
Resolves https://issues.apache.org/jira/browse/ZOOKEEPER-4281
There are sanity checks for packet size when deserializing a packet. One place has the inclusion: len >= packetLen. It rejects to deserialize the bytes that are exactly sized jute.maxbuffer. It's confusing. This check should use ">" so the maxbuffer length packet can still be deserialized, like the other checks.
Solution
Change:
len >= packetLen->len > packetLen