ObjectInputStream.readFully range check incorrect

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P2
    • 18
    • Affects Version/s: None
    • Component/s: core-libs

        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)

              Assignee:
              Roger Riggs
              Reporter:
              Roger Riggs
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: