Commit 507da1a
authored
ZOOKEEPER-4281: Allow packet of max packet length to be deserialized (#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 <[email protected]>
Reviewers: Enrico Olivelli <[email protected]>, Mohammad Arshad <[email protected]>, Michael Han <[email protected]>
Closes apache#1683 from pkuwm/maxPacketLength1 parent b9ee1db commit 507da1a
File tree
2 files changed
+28
-1
lines changed- zookeeper-server/src
- main/java/org/apache/zookeeper
- test/java/org/apache/zookeeper
2 files changed
+28
-1
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
120 | | - | |
| 120 | + | |
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| |||
Lines changed: 27 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
66 | 93 | | |
0 commit comments