8156593: DataOutput.write(byte[],int,int) and its implementations do not specify index out bounds

Reviewed-by: alanb, aturbanov
This commit is contained in:
Brian Burkhalter 2022-10-31 22:18:26 +00:00
parent 8480f87044
commit 4999f2cb16
11 changed files with 17 additions and 2 deletions

View file

@ -156,6 +156,9 @@ public abstract class OutputStream implements Closeable, Flushable {
* @throws IOException if an I/O error occurs. In particular,
* an {@code IOException} is thrown if the output
* stream is closed.
* @throws IndexOutOfBoundsException If {@code off} is negative,
* {@code len} is negative, or {@code len} is greater than
* {@code b.length - off}
*/
public void write(byte[] b, int off, int len) throws IOException {
Objects.checkFromIndexSize(off, len, b.length);