[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-4281?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Huizhi Lu updated ZOOKEEPER-4281:
---------------------------------
    Description: 
 

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.
{code:java}
if (len < 0 || len >= packetLen) {
    throw new IOException("Packet len " + len + " is out of range!");
}
{code}
 

 
{code:java}
if (len < 0 || len > BinaryInputArchive.maxBuffer) {
    throw new IOException("Len error " + len);
}
{code}
 

 

  was:
 

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.
{code:java}
if (len < 0 || len >= packetLen) {
    throw new IOException("Packet len " + len + " is out of range!");
}
{code}
 

 
{code:java}
if (len < 0 || len > BinaryInputArchive.maxBuffer) {
    throw new IOException("Len error " + len);
}
{code}
 

 


> Packet length sanity check is inconsistent
> ------------------------------------------
>
>                 Key: ZOOKEEPER-4281
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-4281
>             Project: ZooKeeper
>          Issue Type: Improvement
>            Reporter: Huizhi Lu
>            Assignee: Huizhi Lu
>            Priority: Major
>
>  
> 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.
> {code:java}
> if (len < 0 || len >= packetLen) {
>     throw new IOException("Packet len " + len + " is out of range!");
> }
> {code}
>  
>  
> {code:java}
> if (len < 0 || len > BinaryInputArchive.maxBuffer) {
>     throw new IOException("Len error " + len);
> }
> {code}
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to