ppkarwasz commented on code in PR #784:
URL: https://github.com/apache/commons-io/pull/784#discussion_r2368021120
##########
src/main/java/org/apache/commons/io/channels/ByteArraySeekableByteChannel.java:
##########
@@ -212,13 +249,12 @@ public int write(final ByteBuffer b) throws IOException {
checkOpen();
lock.lock();
try {
- int wanted = b.remaining();
- final int possibleWithoutResize = size - position;
+ final int wanted = b.remaining();
+ final int possibleWithoutResize = Math.max(0, size - position);
Review Comment:
The `SeekableByteChannel` contract explicitly allows `position` to be larger
than `size`.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]