You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Nelson Bighetti (Jira)" <ji...@apache.org> on 2023/02/13 04:25:00 UTC

[jira] [Updated] (KAFKA-14707) Possible read error in the Array type caused by insufficient remaining bytes

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

Nelson Bighetti updated KAFKA-14707:
------------------------------------
    Description: 
{code:java}
if (size > buffer.remaining())
    throw new SchemaException("Error reading array of size " + size + ", only " + buffer.remaining() + " bytes available"); {code}
Array type has the above code snippet which checks if there are enough bytes in the buffer to read all the array elements. However, there is a unit mismatch because `size` is the number of elements in the array, not the number of bytes. Thus, even if the above check passes there still might be not enough bytes remaining in the buffer. 

  was:
{code:java}
if (size > buffer.remaining())
    throw new SchemaException("Error reading array of size " + size + ", only " + buffer.remaining() + " bytes available"); {code}
Array type has the above code snippet which checks if there are enough bytes in the buffer to read all the array elements. However, there is a unit mismatch because `size` is the number of elements in the array, not the number of bytes. Thus, even if the above check passes buffer still might not have enough bytes to read all the elements.


> Possible read error in the Array type caused by insufficient remaining bytes
> ----------------------------------------------------------------------------
>
>                 Key: KAFKA-14707
>                 URL: https://issues.apache.org/jira/browse/KAFKA-14707
>             Project: Kafka
>          Issue Type: Bug
>          Components: network
>            Reporter: Nelson Bighetti
>            Assignee: Nelson Bighetti
>            Priority: Minor
>
> {code:java}
> if (size > buffer.remaining())
>     throw new SchemaException("Error reading array of size " + size + ", only " + buffer.remaining() + " bytes available"); {code}
> Array type has the above code snippet which checks if there are enough bytes in the buffer to read all the array elements. However, there is a unit mismatch because `size` is the number of elements in the array, not the number of bytes. Thus, even if the above check passes there still might be not enough bytes remaining in the buffer. 



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