mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 14:24:46 +02:00
8322877: java/io/BufferedInputStream/TransferTo.java failed with IndexOutOfBoundsException
Reviewed-by: alanb, stsypanov
This commit is contained in:
parent
30a0c61de0
commit
54b3ceeca2
2 changed files with 2 additions and 3 deletions
|
@ -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.
|
||||
*
|
||||
* 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;
|
||||
if (avail > 0) {
|
||||
if (isTrusted(out)) {
|
||||
out.write(getBufIfOpen(), pos, count);
|
||||
out.write(getBufIfOpen(), pos, avail);
|
||||
} else {
|
||||
// Prevent poisoning and leaking of buf
|
||||
byte[] buffer = Arrays.copyOfRange(getBufIfOpen(), pos, count);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue