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

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 9
    • Affects Version/s: 9
    • Component/s: core-libs
    • b132
    • Verified

                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.

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

                Created:
                Updated:
                Resolved: