The final position instead of the number of bytes to write was being passed to `ByteArrayOuputStream.write(byte[],int,int)`.
------------- Commit messages: - 8322877: java/io/BufferedInputStream/TransferTo.java failed with IndexOutOfBoundsException Changes: https://git.openjdk.org/jdk/pull/17250/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=17250&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8322877 Stats: 3 lines in 2 files changed: 0 ins; 1 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/17250.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/17250/head:pull/17250 PR: https://git.openjdk.org/jdk/pull/17250