bachmanity1 opened a new pull request, #13246: URL: https://github.com/apache/kafka/pull/13246
``` if (size > buffer.remaining()) throw new SchemaException("Error reading array of size " + size + ", only " + buffer.remaining() + " bytes available"); ``` 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. It seems to be impossible to compute byte size of the array before reading the whole array because each element of the array might have a different size (for example, array of strings). In my opinion this code can be removed because it doesn't solve the problem it was written to solve. ### Committer Checklist (excluded from commit message) - [ ] Verify design and implementation - [ ] Verify test coverage and CI build status - [ ] Verify documentation (including upgrade notes) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org