RFR: 8320798: Console read line with zero out should zero out underlying buffer [v2]

Alan Bateman alanb at openjdk.org
Tue Nov 28 20:41:10 UTC 2023


On Tue, 28 Nov 2023 19:27:45 GMT, Naoto Sato <naoto at openjdk.org> wrote:

>> src/java.base/share/classes/sun/nio/cs/StreamDecoder.java line 294:
>> 
>>> 292:     private void lockedFillZeroToPosition() throws IOException {
>>> 293:         ensureOpen();
>>> 294:         Arrays.fill(bb.array(), 0, bb.arrayOffset() + bb.position(), (byte)0);
>> 
>> Should the `from` parameter be zero or `bb.arrayOffset()`?
>
> Right. Fixed.

The buffer is allocated in StreamDecoder so I assume the array offset is 0 anyway, so I think they will be the same.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/16861#discussion_r1408394249


More information about the nio-dev mailing list