choijunwoo opened a new pull request, #1058:
URL: https://github.com/apache/tomcat/pull/1058

   ## Problem
   
   `ChunkedOutputFilter` reuses the `lastChunk`, `crlfChunk`, and `endChunk`
   `ByteBuffer` instances across responses.
   
   The `end()` method resets these buffers only after the corresponding 
downstream
   write completes successfully. If `HttpOutputBuffer.doWrite()` consumes part 
of a
   buffer and then throws an `IOException`, the reset is skipped.
   
   When the owning `Http11Processor` is subsequently recycled, the same
   `ChunkedOutputFilter` may be reused with the stale buffer position. For 
example,
   if the first two bytes (`0\r`) of the terminal chunk (`0\r\n\r\n`) were 
consumed
   before the exception, the next response would write only the remaining
   `\n\r\n`.
   
   ## Fix
   
   Reset the position to zero and the limit to the capacity for all reusable 
chunk
   buffers in `ChunkedOutputFilter.recycle()`:
   
   - `lastChunk`
   - `crlfChunk`
   - `endChunk`
   
   This mirrors the reset already performed after successful writes while also
   covering exceptional write paths.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to