8322877: java/io/BufferedInputStream/TransferTo.java failed with IndexOutOfBoundsException

Reviewed-by: alanb, stsypanov
This commit is contained in:
Brian Burkhalter 2024-01-03 21:23:06 +00:00
parent 30a0c61de0
commit 54b3ceeca2
2 changed files with 2 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1994, 2023, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1994, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -644,7 +644,7 @@ public class BufferedInputStream extends FilterInputStream {
int avail = count - pos; int avail = count - pos;
if (avail > 0) { if (avail > 0) {
if (isTrusted(out)) { if (isTrusted(out)) {
out.write(getBufIfOpen(), pos, count); out.write(getBufIfOpen(), pos, avail);
} else { } else {
// Prevent poisoning and leaking of buf // Prevent poisoning and leaking of buf
byte[] buffer = Arrays.copyOfRange(getBufIfOpen(), pos, count); byte[] buffer = Arrays.copyOfRange(getBufIfOpen(), pos, count);

View File

@ -503,7 +503,6 @@ java/lang/instrument/RetransformBigClass.sh 8065756 generic-
# jdk_io # jdk_io
java/io/pathNames/GeneralWin32.java 8180264 windows-all java/io/pathNames/GeneralWin32.java 8180264 windows-all
java/io/BufferedInputStream/TransferTo.java 8322877 generic-all
############################################################################ ############################################################################