Author: markt
Date: Wed Mar 19 15:27:11 2014
New Revision: 1579262
URL: http://svn.apache.org/r1579262
Log:
Improve processing of chuck size from chunked headers. Avoid overflow and use a
bit shift instead of a multiplication as it is marginally faster.
Modified:
tomcat/tc6.0.x/trunk/STATUS.txt
tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java
tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml
Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL:
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=1579262&r1=1579261&r2=1579262&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Wed Mar 19 15:27:11 2014
@@ -28,15 +28,6 @@ None
PATCHES PROPOSED TO BACKPORT:
[ New proposals should be added at the end of the list ]
-* Improve processing of chuck size from chunked headers. Avoid overflow and use
- a bit shift instead of a multiplication as it is marginally faster.
-
http://people.apache.org/~markt/patches/2014-03-17-chunked-headers-tc6-v1.patch
- +1: markt, kkolinko, remm
- -1:
- kkolinko: Technical notes:
- 1. r1578329 does not belong to svn:mergeinfo, that is an unrelated commit
- 2. changelog.xml part of the patch does not merge, because of later changes
-
* Redefine the <code>globalXsltFile</code> initialisation parameter of the
DefaultServlet as relative to CATALINA_BASE/conf or CATALINA_HOME/conf.
Prevent user supplied XSLTs used by the DefaultServlet from defining external
Modified:
tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java
URL:
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java?rev=1579262&r1=1579261&r2=1579262&view=diff
==============================================================================
---
tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java
(original)
+++
tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java
Wed Mar 19 15:27:11 2014
@@ -303,7 +303,7 @@ public class ChunkedInputFilter implemen
int result = 0;
boolean eol = false;
- boolean readDigit = false;
+ int readDigit = 0;
boolean extension = false;
while (!eol) {
@@ -325,10 +325,9 @@ public class ChunkedInputFilter implemen
} else if (!extension) {
//don't read data after the trailer
int charValue = HexUtils.getDec(buf[pos]);
- if (charValue != -1) {
- readDigit = true;
- result *= 16;
- result += charValue;
+ if (charValue != -1 && readDigit < 8) {
+ readDigit++;
+ result = (result << 4) | charValue;
} else {
//we shouldn't allow invalid, non hex characters
//in the chunked header
@@ -352,7 +351,7 @@ public class ChunkedInputFilter implemen
}
- if (!readDigit)
+ if (readDigit == 0 || result < 0)
return false;
if (result == 0)
Modified: tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml
URL:
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml?rev=1579262&r1=1579261&r2=1579262&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Wed Mar 19 15:27:11 2014
@@ -65,6 +65,15 @@
</fix>
</changelog>
</subsection>
+ <subsection name="Coyote">
+ <changelog>
+ <fix>
+ Improve processing of chuck size from chunked headers. Avoid overflow
+ and use a bit shift instead of a multiplication as it is marginally
+ faster. (markt/kkolinko)
+ </fix>
+ </changelog>
+ </subsection>
<subsection name="Jasper">
<changelog>
<fix>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]