[ 
https://issues.apache.org/jira/browse/AVRO-3783?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17733633#comment-17733633
 ] 

ASF subversion and git services commented on AVRO-3783:
-------------------------------------------------------

Commit 1a14a00ea35220f7f6b0398cd6f01d936da3ec88 in avro's branch 
refs/heads/master from Jack Klamer
[ https://gitbox.apache.org/repos/asf?p=avro.git;h=1a14a00ea ]

AVRO-3783: Read LONG length for bytes, only allow INT sizes (#2210)

* Read long length for bytes. Only allow Int sizes

* Add test for VLE int long equality

> [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
>              Labels: pull-request-available
>             Fix For: 1.11.2
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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