8276806: Use Objects.checkFromIndexSize where possible in java.base

Reviewed-by: rriggs, lancea
This commit is contained in:
Sergey Tsypanov 2021-12-02 20:00:49 +00:00 committed by Roger Riggs
parent 30087cc1b8
commit 73a9654c26
11 changed files with 40 additions and 43 deletions

View file

@ -28,6 +28,7 @@ package java.util.zip;
import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Objects;
/**
* Implements an output stream filter for uncompressing data stored in the
@ -223,9 +224,9 @@ public class InflaterOutputStream extends FilterOutputStream {
ensureOpen();
if (b == null) {
throw new NullPointerException("Null buffer for read");
} else if (off < 0 || len < 0 || len > b.length - off) {
throw new IndexOutOfBoundsException();
} else if (len == 0) {
}
Objects.checkFromIndexSize(off, len, b.length);
if (len == 0) {
return;
}