-
Bug
-
Resolution: Fixed
-
P2
-
None
-
b28
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8278724 | 19 | Roger Riggs | P2 | Closed | Fixed | b28 |
ObjectInputStream.readFully(byte[], off, len) throws IndexOutOfBoundsException when passed the length is less than the offset.
It is treating the length as the toOffset.
The replacement of the range check should have used checkFromIndexSize instead of checkFromToIndex.
java.lang.IndexOutOfBoundsException: Range [4, 0) out of bounds for length 10
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:100)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckFromToIndex(Preconditions.java:112)
at java.base/jdk.internal.util.Preconditions.checkFromToIndex(Preconditions.java:349)
at java.base/java.util.Objects.checkFromToIndex(Objects.java:385)
at java.base/java.io.ObjectInputStream.readFully(ObjectInputStream.java:1207)
at javasoft.sqe.tests.api.java.io.Serialization.ObjectInputStream.ReadFullyTests.ReadFully0007(ReadFullyTests.java:276)
at javasoft.sqe.tests.api.java.io.Serialization.ObjectInputStream.ReadFullyTests.run(ReadFullyTests.java:66)
It is treating the length as the toOffset.
The replacement of the range check should have used checkFromIndexSize instead of checkFromToIndex.
java.lang.IndexOutOfBoundsException: Range [4, 0) out of bounds for length 10
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:100)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckFromToIndex(Preconditions.java:112)
at java.base/jdk.internal.util.Preconditions.checkFromToIndex(Preconditions.java:349)
at java.base/java.util.Objects.checkFromToIndex(Objects.java:385)
at java.base/java.io.ObjectInputStream.readFully(ObjectInputStream.java:1207)
at javasoft.sqe.tests.api.java.io.Serialization.ObjectInputStream.ReadFullyTests.ReadFully0007(ReadFullyTests.java:276)
at javasoft.sqe.tests.api.java.io.Serialization.ObjectInputStream.ReadFullyTests.run(ReadFullyTests.java:66)
- backported by
-
JDK-8278724 ObjectInputStream.readFully range check incorrect
-
- Closed
-
- relates to
-
JDK-8276806 Use Objects.checkFromIndexSize where possible in java.base
-
- Resolved
-