You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Mike Percy (JIRA)" <ji...@apache.org> on 2012/11/08 01:52:12 UTC
[jira] [Created] (AVRO-1198) Malformed Avro data may cause
confusing ArrayIndexOutOfBoundsException
Mike Percy created AVRO-1198:
--------------------------------
Summary: Malformed Avro data may cause confusing ArrayIndexOutOfBoundsException
Key: AVRO-1198
URL: https://issues.apache.org/jira/browse/AVRO-1198
Project: Avro
Issue Type: Bug
Components: java
Affects Versions: 1.7.2
Reporter: Mike Percy
Fix For: 1.7.3
I am currently debugging an issue where I am getting an ArrayIndexOutOfBoundsException from the decoder while reading some Avro data. Turns out that the integer indicating number of bytes to read next is negative. It would be better if a more helpful error message were provided.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (AVRO-1198) Malformed Avro data may cause
confusing ArrayIndexOutOfBoundsException
Posted by "Mike Percy (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/AVRO-1198?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mike Percy updated AVRO-1198:
-----------------------------
Attachment: AVRO-1198-1.patch
Simple patch to throw an IllegalArgumentException if this occurs. I don't know if this is acceptable since I am not super familiar with this code, so just starting with something.
Before:
java.lang.ArrayIndexOutOfBoundsException
at org.apache.avro.io.BinaryDecoder.doReadBytes(BinaryDecoder.java:329)
at org.apache.avro.io.BinaryDecoder.readString(BinaryDecoder.java:255)
at org.apache.avro.io.BinaryDecoder.readString(BinaryDecoder.java:264)
at org.apache.avro.io.ValidatingDecoder.readString(ValidatingDecoder.java:113)
...
After:
java.lang.IllegalArgumentException: Attempt to read negative length: -50
at org.apache.avro.io.BinaryDecoder.doReadBytes(BinaryDecoder.java:329)
at org.apache.avro.io.BinaryDecoder.readString(BinaryDecoder.java:255)
at org.apache.avro.io.BinaryDecoder.readString(BinaryDecoder.java:264)
at org.apache.avro.io.ValidatingDecoder.readString(ValidatingDecoder.java:113)
...
> Malformed Avro data may cause confusing ArrayIndexOutOfBoundsException
> ----------------------------------------------------------------------
>
> Key: AVRO-1198
> URL: https://issues.apache.org/jira/browse/AVRO-1198
> Project: Avro
> Issue Type: Bug
> Components: java
> Affects Versions: 1.7.2
> Reporter: Mike Percy
> Fix For: 1.7.3
>
> Attachments: AVRO-1198-1.patch
>
>
> I am currently debugging an issue where I am getting an ArrayIndexOutOfBoundsException from the decoder while reading some Avro data. Turns out that the integer indicating number of bytes to read next is negative. It would be better if a more helpful error message were provided.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (AVRO-1198) Malformed Avro data may cause
confusing ArrayIndexOutOfBoundsException
Posted by "Mike Percy (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/AVRO-1198?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mike Percy updated AVRO-1198:
-----------------------------
Assignee: Mike Percy
Status: Patch Available (was: Open)
> Malformed Avro data may cause confusing ArrayIndexOutOfBoundsException
> ----------------------------------------------------------------------
>
> Key: AVRO-1198
> URL: https://issues.apache.org/jira/browse/AVRO-1198
> Project: Avro
> Issue Type: Bug
> Components: java
> Affects Versions: 1.7.2
> Reporter: Mike Percy
> Assignee: Mike Percy
> Fix For: 1.7.3
>
> Attachments: AVRO-1198-1.patch
>
>
> I am currently debugging an issue where I am getting an ArrayIndexOutOfBoundsException from the decoder while reading some Avro data. Turns out that the integer indicating number of bytes to read next is negative. It would be better if a more helpful error message were provided.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (AVRO-1198) Malformed Avro data may cause
confusing ArrayIndexOutOfBoundsException
Posted by "Mike Percy (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/AVRO-1198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13493803#comment-13493803 ]
Mike Percy commented on AVRO-1198:
----------------------------------
Doug, this looks good to me. I suppose we should add a unit test for this scenario as well.
> Malformed Avro data may cause confusing ArrayIndexOutOfBoundsException
> ----------------------------------------------------------------------
>
> Key: AVRO-1198
> URL: https://issues.apache.org/jira/browse/AVRO-1198
> Project: Avro
> Issue Type: Bug
> Components: java
> Affects Versions: 1.7.2
> Reporter: Mike Percy
> Assignee: Mike Percy
> Fix For: 1.7.3
>
> Attachments: AVRO-1198-1.patch, AVRO-1198.patch
>
>
> I am currently debugging an issue where I am getting an ArrayIndexOutOfBoundsException from the decoder while reading some Avro data. Turns out that the integer indicating number of bytes to read next is negative. It would be better if a more helpful error message were provided.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (AVRO-1198) Malformed Avro data may cause
confusing ArrayIndexOutOfBoundsException
Posted by "Doug Cutting (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/AVRO-1198?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Doug Cutting updated AVRO-1198:
-------------------------------
Attachment: AVRO-1198.patch
The user didn't pass the negative length so IllegalArgumentException is not so relevant. We ought to call attention to the fact that this indicates malformed Avro data. Here's a version that throws an AvroRuntimeException with the message, "Malformed data. Length is negative: XXX".
> Malformed Avro data may cause confusing ArrayIndexOutOfBoundsException
> ----------------------------------------------------------------------
>
> Key: AVRO-1198
> URL: https://issues.apache.org/jira/browse/AVRO-1198
> Project: Avro
> Issue Type: Bug
> Components: java
> Affects Versions: 1.7.2
> Reporter: Mike Percy
> Assignee: Mike Percy
> Fix For: 1.7.3
>
> Attachments: AVRO-1198-1.patch, AVRO-1198.patch
>
>
> I am currently debugging an issue where I am getting an ArrayIndexOutOfBoundsException from the decoder while reading some Avro data. Turns out that the integer indicating number of bytes to read next is negative. It would be better if a more helpful error message were provided.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira