Uploaded image for project: 'HttpComponents HttpCore'
  1. HttpComponents HttpCore
  2. HTTPCORE-312

LengthDelimitedEncoder fails on content length > 32 bit

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 4.2
    • 4.2.2
    • HttpCore NIO
    • None

    Description

      The LengthDelimitedEncoder class fails to deliver contents that are larger than 2GB, because the write(final ByteBuffer src) method incorrectly calculates

      int lenRemaining = (int) (this.contentLength - this.len);

      For example, if this.contentLength is 3,000,000,000 and this.len is 0, then lenRemaining will be negative and things will go wrong in the process.

      Changing the line to

      long lenRemaining = this.contentLength - this.len;

      will fix this bug (maybe src.remaining() needs to be casted to (long) in the following if statement).

      Attachments

        Activity

          People

            Unassigned Unassigned
            roland237 Roland Hänel
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: