Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8163518

Integer overflow in StringBufferInputStream.read() and CharArrayReader.read/skip()

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b132
    • Verification:
      Verified

      Backports

        Description

                if (pos + len > count) {
                    len = count - pos;
                }

        Here len can be close to Integer.MAX_VALUE and pos > 0, which can result in negative (pos + len).

        As a result, read() throws inappropriate StringIndexOutOfBoundsException.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  igerasim Ivan Gerasimov
                  Reporter:
                  igerasim Ivan Gerasimov
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: