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

Base64.Encoder.wrap(os).write(byte[],int,int) with incorrect arguments should not produce output

    Details

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

      Backports

        Description

        An output stream 'es' can be obtained as encoder.wrap(os).
        Normally, es.write(buf, off, len) throws IndexOutOfBoundException, if the referenced portion lies outside the buffer. In this case, nothing is written to the underlying output stream 'os'.

        However, if (off + len) numerically overflows, then the call to write() will produce some output and only when reached the boundary of the buf will throw the exception.

        This behavior looks inconsistent.

          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: