You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Thiruvalluvan M. G. (JIRA)" <ji...@apache.org> on 2012/05/21 07:54:40 UTC

[jira] [Updated] (AVRO-1097) BinaryDecoder does not detect EOF sometimes

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

Thiruvalluvan M. G. updated AVRO-1097:
--------------------------------------

    Attachment: AVRO-1097.patch

This patch addresses the issue by checking if there are indeed bytes to be decoded. If not, it throws an EOFException. If there are some bytes and they do not constitute a valid Zigzag encoding, it throws "Invalid int/long encoding" exception.
                
> BinaryDecoder does not detect EOF sometimes
> -------------------------------------------
>
>                 Key: AVRO-1097
>                 URL: https://issues.apache.org/jira/browse/AVRO-1097
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>            Reporter: Thiruvalluvan M. G.
>            Assignee: Thiruvalluvan M. G.
>             Fix For: 1.7.0
>
>         Attachments: AVRO-1097.patch
>
>
> This is the first problem reported in AVRO-1058.
> The trouble is, in case of end of stream, ensureBounds() does not really ensure that the requisite number of actual bytes are available in the buffer. It merely ensures that there won't be array index overflow. readInt() and readLong() check for overflow at the very end. But these two methods continue to read whatever bytes are in the buffer and interpret. If the bytes do not really belong to the stream (because of EOF), they need not be valid Zigzag encoding. That is the reason we get the "Invalid int encoding" exception.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira