Skip to content

Commit 54b3cee

Browse files
author
Brian Burkhalter
committed
8322877: java/io/BufferedInputStream/TransferTo.java failed with IndexOutOfBoundsException
Reviewed-by: alanb, stsypanov
1 parent 30a0c61 commit 54b3cee

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/java.base/share/classes/java/io/BufferedInputStream.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1994, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1994, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -644,7 +644,7 @@ private long implTransferTo(OutputStream out) throws IOException {
644644
int avail = count - pos;
645645
if (avail > 0) {
646646
if (isTrusted(out)) {
647-
out.write(getBufIfOpen(), pos, count);
647+
out.write(getBufIfOpen(), pos, avail);
648648
} else {
649649
// Prevent poisoning and leaking of buf
650650
byte[] buffer = Arrays.copyOfRange(getBufIfOpen(), pos, count);

test/jdk/ProblemList.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,6 @@ java/lang/instrument/RetransformBigClass.sh 8065756 generic-
503503
# jdk_io
504504

505505
java/io/pathNames/GeneralWin32.java 8180264 windows-all
506-
java/io/BufferedInputStream/TransferTo.java 8322877 generic-all
507506

508507
############################################################################
509508

0 commit comments

Comments
 (0)