Bug 1128396 - NullPointerException in chunked transfer encoding input filter when processing last-chunk [NEEDINFO]
Summary: NullPointerException in chunked transfer encoding input filter when processin...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: tomcat6
Version: 6.5
Hardware: noarch
OS: Linux
unspecified
high
Target Milestone: rc
: ---
Assignee: David Knox
QA Contact: tomcat-qe
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-08-10 02:30 UTC by stein
Modified: 2019-07-11 08:07 UTC (History)
9 users (show)

Fixed In Version: tomcat6-6.0.24-87.el6
Doc Type: Bug Fix
Doc Text:
Requests using chunked transfer encoding generated a "NullPointerException" in the parseHeader() function of ChunkedInputFilter.java when the last chunk was processed. Consequently, HTTP connection was aborted by tomcat. The underlying code has been amended, and HTTP connection is no longer lost in this situation.
Clone Of:
Environment:
Last Closed: 2015-07-22 07:27:52 UTC
dknox: needinfo? (tomcat-qe)


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:1461 normal SHIPPED_LIVE tomcat6 bug fix and enhancement update 2015-07-21 14:14:55 UTC

Description stein 2014-08-10 02:30:22 UTC
Description of problem:
Requests using chunked transfer encoding will generate a NullPointerException in parseHeader() of ChunkedInputFilter.java when the zero-length last-chunk is processed.

Sample log entry from catalina.out:
Aug 01, 2014 12:34:56 AM org.apache.coyote.http11.Http11Processor process
SEVERE: Error finishing request
java.lang.NullPointerException
        at org.apache.coyote.http11.filters.ChunkedInputFilter.parseHeader(ChunkedInputFilter.java:420)
        at org.apache.coyote.http11.filters.ChunkedInputFilter.parseEndChunk(ChunkedInputFilter.java:409)
        at org.apache.coyote.http11.filters.ChunkedInputFilter.doRead(ChunkedInputFilter.java:155)
        at org.apache.coyote.http11.filters.ChunkedInputFilter.end(ChunkedInputFilter.java:208)
        at org.apache.coyote.http11.InternalInputBuffer.endRequest(InternalInputBuffer.java:336)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:886)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:745)


Patch file tomcat6-6.0.24-CVE-2013-4322.patch, which was introduced with 6.0.24.64, modified the doRead() function in ChunkedInputFilter.java by adding the following line at the start of doRead():

        this.request = req;

However, this line does not appear in the upstream tomcat6 source for ChunkedInputFilter.java.  Is it a typo?

By overwriting 'request' at this point in doRead(), the NullPointerException occurs when the following line at the start of parseHeader() is executed when processing the last chunk (other chunks are processed without error):

        MimeHeaders headers = request.getMimeHeaders();


The fix is to comment out (or remove) the "this.request = req;" line in the doRead() function in java/org/apache/coyote/http11/filters/ChunkedInputFilter.java



Version-Release number of selected component (if applicable):
tomcat6 6.0.24.64.el6
tomcat6 6.0.24.72.el6


How reproducible:
NullPointerException occurs every time


Steps to Reproduce:
1. Generate an HTTP request to tomcat using chunked Transfer Encoding, such as:

POST /application HTTP/1.1
Host: localhost:8080
Transfer-Encoding: chunked

2d
<html><body>TEST TEST TEST TEST</body></html>
0



Actual results:
java.lang.NullPointerException logged to catalina.out and HTTP connection is aborted by tomcat

Expected results:
No exceptions are logged and the HTTP connection is not aborted abnormally by tomcat

Comment 2 stein 2014-08-13 20:55:06 UTC
error still occurs with tomcat6 6.0.24.78.el6

Comment 8 errata-xmlrpc 2015-07-22 07:27:52 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-1461.html


Note You need to log in before you can comment on or make changes to this bug.