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

Ryan Skraba reassigned AVRO-3783:
---------------------------------


> [Java] Deserialize byte lengths as LONG but limit to INT
> --------------------------------------------------------
>
>                 Key: AVRO-3783
>                 URL: https://issues.apache.org/jira/browse/AVRO-3783
>             Project: Apache Avro
>          Issue Type: Bug
>            Reporter: Jack Klamer
>            Assignee: Jack Klamer
>            Priority: Major
>             Fix For: 1.11.2
>
>
> In the spec, the encoding for the bytes type is bytes are encoded as a long 
> followed by that many bytes of data.. In the Java binary decoders they are 
> read as ints this is not a correctness issue because the VLE of the long is 
> the same as that of an equivalently valued int. The int is used (I assume) to 
> enable easier interop with the ByteBuffer java class. But in the rare cases 
> where validly encoded data of more than MAX_ARRAY_SIZE bytes is found, this 
> change will cause an error of
> {code}
> throw new UnsupportedOperationException(
>           "Cannot read arrays longer than " + MAX_ARRAY_SIZE + " bytes in 
> Java library");
> {code}
> instead of
> {code}
> throw new InvalidNumberEncodingException("Invalid int encoding");
> {code}
> This type of checking is consistent with what happens in readString which 
> reads its size as a long.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to