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:13:00 UTC

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

Nelson Bighetti created KAFKA-14707:
---------------------------------------

             Summary: 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


{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.



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