divijvaidya commented on code in PR #12948: URL: https://github.com/apache/kafka/pull/12948#discussion_r1242078745
########## clients/src/main/java/org/apache/kafka/common/utils/ChunkedBytesStream.java: ########## @@ -290,25 +290,27 @@ public long skip(long toSkip) throws IOException { // Skip bytes stored in intermediate buffer first int avail = count - pos; - long bytesSkipped = (avail < remaining) ? avail : remaining; + int bytesSkipped = Math.min(avail, (int) remaining); Review Comment: I am not sure that this is a good idea to downcast and then perform comparison. Comparison amongst different types is performed by upgrading them to the higher type and then performing comparison. In current approach, we downcasting `remaining` to int is unsafe. May I suggest an alternative where we upgrade avail to `long` before performing comparison and then converting result to int:` int bytesSkipped = (int) Math.min((long) avail, remaining);` -- 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