bachmanity1 opened a new pull request, #13237:
URL: https://github.com/apache/kafka/pull/13237

   ```
   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. 
   
   This PR handles this issue by first reading the first element and then 
computing the byte size of the array. I've added one unit test.
   
   
   
   ### 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

Reply via email to