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

[GitHub] [kafka] bachmanity1 opened a new pull request, #13237: KAFKA-14707: Handle possible read error in the Array type caused by insufficient remaining bytes

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-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [kafka] bachmanity1 commented on pull request #13237: KAFKA-14707: Handle possible read error in the Array type caused by insufficient remaining bytes

Posted by "bachmanity1 (via GitHub)" <gi...@apache.org>.
bachmanity1 commented on PR #13237:
URL: https://github.com/apache/kafka/pull/13237#issuecomment-1427337620

   @cmccabe @granthenke could you please review this?


-- 
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-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [kafka] bachmanity1 commented on pull request #13237: KAFKA-14707: Handle possible read error in the Array type caused by insufficient remaining bytes

Posted by "bachmanity1 (via GitHub)" <gi...@apache.org>.
bachmanity1 commented on PR #13237:
URL: https://github.com/apache/kafka/pull/13237#issuecomment-1427626340

   sorry for bothering, I've just realized that array elements may have different sizes. 


-- 
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-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [kafka] bachmanity1 closed pull request #13237: KAFKA-14707: Handle possible read error in the Array type caused by insufficient remaining bytes

Posted by "bachmanity1 (via GitHub)" <gi...@apache.org>.
bachmanity1 closed pull request #13237: KAFKA-14707: Handle possible read error in the Array type caused by insufficient remaining bytes
URL: https://github.com/apache/kafka/pull/13237


-- 
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-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org