Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-2142

ChunkedStreamSinkConduit write with a buffer array writes too few buffers

    XMLWordPrintable

Details

    Description

      This may manifest in an infinite hot loop as the caller and callee disagree about whether or not data remains in the source buffers.

       

      In this loop, 'length' of the buffers should be written, however length is used as a limit rather than length:
      https://github.com/undertow-io/undertow/blob/e11eba5695c4bf09ed50f298765b876f01f9745c/core/src/main/java/io/undertow/conduits/ChunkedStreamSinkConduit.java#L216-L222

       

       

              for (int i = offset; i < length; ++i) {
                  if (srcs[i].hasRemaining()) {
                      return write(srcs[i]);
                  }
              } 

      should be

       

       

              for (int i = offset; i < offset + length; ++i) {
                  if (srcs[i].hasRemaining()) {
                      return write(srcs[i]);
                  }
              } 

       

       

      Attachments

        Issue Links

          Activity

            Public project attachment banner

              context keys: [headless, issue, helper, isAsynchronousRequest, project, action, user]
              current Project key: UNDERTOW

              People

                flaviarnn Flavia Rainone
                carterkozak Carter Kozak
                Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: