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

ChannelInputStream.readNBytes(int) incorrectly calls readAllBytes()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 18
    • 18
    • core-libs
    • None
    • 18
    • b19
    • generic
    • generic

    Description

      JDK-8268435 contains a cut-and-paste error which calls readNBytes() from the readAllBytes() implementation:

              if (!(ch instanceof SeekableByteChannel sbc))
                  return super.readAllBytes();

      https://github.com/openjdk/jdk/commit/0786d8b7b367e3aa3ffa54a3e339572938378dca#diff-21e4ff89fd54955e45fcd085ae8c08033b6c92de7f98ab0c836d4f754117ececR171

      Since IntputStream.readAllBytes() calls readNBytes() again, this results in a stack overflow (rather than incorrect data being returned).

      Attachments

        Issue Links

          Activity

            People

              fweimer Florian Weimer
              fweimer Florian Weimer
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: