You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2015/02/13 13:35:32 UTC

svn commit: r1659539 - in /tomcat/tc6.0.x/trunk: ./ java/org/apache/coyote/http11/ webapps/docs/

Author: markt
Date: Fri Feb 13 12:35:32 2015
New Revision: 1659539

URL: http://svn.apache.org/r1659539
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=57544
Avoid potential infinite loop. Chances are this is only triggered by code (WebSocket, non-blocking, async) that isn't in 6.0.x but better to clean it up anyway.

Modified:
    tomcat/tc6.0.x/trunk/STATUS.txt
    tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java
    tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/InternalInputBuffer.java
    tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.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=1659539&r1=1659538&r2=1659539&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Fri Feb 13 12:35:32 2015
@@ -34,14 +34,6 @@ PATCHES PROPOSED TO BACKPORT:
   +1: kkolinko, remm, markt
   -1:
 
-* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=57544
-  Avoid potential infinite loop. Chances are this is only triggered by code
-  (WebSocket, non-blocking, async) that isn't in 6.0.x but better to clean it up
-  anyway.
-  http://people.apache.org/~markt/patches/2015-02-08-bug57544-tc6-v1.patch
-  +1: markt, kkolinko, remm
-  -1:
-
 * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=57558
   Add missing JARs in Ant task definition. Expand the pattern in
   catalina-tasks.xml to include all jars in ${catalina.home}/lib.

Modified: tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java?rev=1659539&r1=1659538&r2=1659539&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java Fri Feb 13 12:35:32 2015
@@ -29,7 +29,6 @@ import org.apache.tomcat.util.buf.ByteCh
 import org.apache.tomcat.util.buf.MessageBytes;
 import org.apache.tomcat.util.http.MimeHeaders;
 import org.apache.tomcat.util.res.StringManager;
-
 import org.apache.coyote.InputBuffer;
 import org.apache.coyote.Request;
 
@@ -302,15 +301,8 @@ public class InternalAprInputBuffer impl
         request.recycle();
 
         // Copy leftover bytes to the beginning of the buffer
-        if (lastValid - pos > 0) {
-            int npos = 0;
-            int opos = pos;
-            while (lastValid - opos > opos - npos) {
-                System.arraycopy(buf, opos, buf, npos, opos - npos);
-                npos += pos;
-                opos += pos;
-            }
-            System.arraycopy(buf, opos, buf, npos, lastValid - opos);
+        if (lastValid - pos > 0 && pos > 0) {
+            System.arraycopy(buf, pos, buf, 0, lastValid - pos);
         }
         
         // Recycle filters

Modified: tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/InternalInputBuffer.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/InternalInputBuffer.java?rev=1659539&r1=1659538&r2=1659539&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/InternalInputBuffer.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/InternalInputBuffer.java Fri Feb 13 12:35:32 2015
@@ -303,15 +303,8 @@ public class InternalInputBuffer impleme
         request.recycle();
 
         // Copy leftover bytes to the beginning of the buffer
-        if (lastValid - pos > 0) {
-            int npos = 0;
-            int opos = pos;
-            while (lastValid - opos > opos - npos) {
-                System.arraycopy(buf, opos, buf, npos, opos - npos);
-                npos += pos;
-                opos += pos;
-            }
-            System.arraycopy(buf, opos, buf, npos, lastValid - opos);
+        if (lastValid - pos > 0 && pos > 0) {
+            System.arraycopy(buf, pos, buf, 0, lastValid - pos);
         }
 
         // Recycle filters

Modified: tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java?rev=1659539&r1=1659538&r2=1659539&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java Fri Feb 13 12:35:32 2015
@@ -372,15 +372,8 @@ public class InternalNioInputBuffer impl
         request.recycle();
 
         // Copy leftover bytes to the beginning of the buffer
-        if (lastValid - pos > 0) {
-            int npos = 0;
-            int opos = pos;
-            while (lastValid - opos > opos - npos) {
-                System.arraycopy(buf, opos, buf, npos, opos - npos);
-                npos += pos;
-                opos += pos;
-            }
-            System.arraycopy(buf, opos, buf, npos, lastValid - opos);
+        if (lastValid - pos > 0 && pos > 0) {
+            System.arraycopy(buf, pos, buf, 0, lastValid - pos);
         }
 
         // Recycle filters

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=1659539&r1=1659538&r2=1659539&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Fri Feb 13 12:35:32 2015
@@ -70,6 +70,10 @@
         that many bytes first before closing the connection to give the client a
         chance to read the reponse. (markt)
       </fix>
+      <fix>
+        <bug>57544</bug>: Fix a potential infinite loop when preparing a kept
+        alive HTTP connection for the next request. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Jasper">



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org