On Tue, 3 Nov 2020 00:04:58 GMT, Brian Burkhalter <b...@openjdk.org> wrote:
> InputStream::readNBytes() invokes read(byte[],int,int) repeatedly to load > bytes into a sequence of intermediate arrays. If an intermediate array is not > completely filled before being added to the list of arrays the contents of > which are eventually concatenated to produce the result, then the unfilled > part of the intermediate array will contribute zeros to the result which are > not actually in the input. This can occur for example if n < 8192 bytes are > read into an intermediate array without filling it, and the next read() > returns zero. It is proposed to detect when an intermediate array is only > partially full, and to copy the valid range of the array into a new array > which is instead appended to the list of component arrays. Marked as reviewed by bchristi (Reviewer). ------------- PR: https://git.openjdk.java.net/jdk/pull/1024