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 2011/07/12 00:27:06 UTC

svn commit: r1145383 - in /tomcat/trunk: java/org/apache/tomcat/util/net/NioEndpoint.java webapps/docs/changelog.xml

Author: markt
Date: Mon Jul 11 22:27:06 2011
New Revision: 1145383

URL: http://svn.apache.org/viewvc?rev=1145383&view=rev
Log:
Protect against infinite loops in the HTTP NIO connector if sendfile is configured to send more data than is available in the file. (markt)

Modified:
    tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
    tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=1145383&r1=1145382&r2=1145383&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Mon Jul 11 22:27:06 2011
@@ -1240,6 +1240,13 @@ public class NioEndpoint extends Abstrac
                         sd.pos += written;
                         sd.length -= written;
                         attachment.access();
+                    } else {
+                        // Unusual not to be unable to transfer any bytes
+                        // Check the length was set correctly
+                        if (sd.fchannel.size() <= sd.pos) {
+                            throw new IOException("Sendfile configured to " +
+                                    "send more data than was available");
+                        }
                     }
                 }
                 if ( sd.length <= 0 && sc.getOutboundRemaining()<=0) {

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1145383&r1=1145382&r2=1145383&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Mon Jul 11 22:27:06 2011
@@ -120,6 +120,10 @@
         Add missing thread name in RequestProcessor when Servlet 3 Async
         is used. Fixes null thread name in access log and JMX MBean. (rjung)
       </fix>
+      <fix>
+        Protect against infinite loops in the HTTP NIO connector if sendfile is
+        configured to send more data than is available in the file. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Cluster">



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


Re: svn commit: r1145383 - in /tomcat/trunk: java/org/apache/tomcat/util/net/NioEndpoint.java webapps/docs/changelog.xml

Posted by Mark Thomas <ma...@apache.org>.
On 12/07/2011 06:49, Felix Schumacher wrote:
> 
> Hi Mark,
> 
> markt@apache.org schrieb:
> 
>> Author: markt
>> Date: Mon Jul 11 22:27:06 2011
>> New Revision: 1145383
>>
>> URL: http://svn.apache.org/viewvc?rev=1145383&view=rev
>> Log:
>> Protect against infinite loops in the HTTP NIO connector if sendfile is
>> configured to send more data than is available in the file. (markt)
>>
>> Modified:
>>    tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
>>    tomcat/trunk/webapps/docs/changelog.xml
>>
>> Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
>> URL:
>> http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=1145383&r1=1145382&r2=1145383&view=diff
>> ==============================================================================
>> --- tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
>> (original)
>> +++ tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Mon
>> Jul 11 22:27:06 2011
>> @@ -1240,6 +1240,13 @@ public class NioEndpoint extends Abstrac
>>                         sd.pos += written;
>>                         sd.length -= written;
>>                         attachment.access();
>> +                    } else {
>> +                        // Unusual not to be unable to transfer any
>> bytes
> There really are too many negations for me to understand the meaning of the above, but I think you mean "able".

Yep. Thanks. Fixed.

Mark



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


Re: svn commit: r1145383 - in /tomcat/trunk: java/org/apache/tomcat/util/net/NioEndpoint.java webapps/docs/changelog.xml

Posted by Felix Schumacher <fe...@internetallee.de>.
Hi Mark,

markt@apache.org schrieb:

>Author: markt
>Date: Mon Jul 11 22:27:06 2011
>New Revision: 1145383
>
>URL: http://svn.apache.org/viewvc?rev=1145383&view=rev
>Log:
>Protect against infinite loops in the HTTP NIO connector if sendfile is
>configured to send more data than is available in the file. (markt)
>
>Modified:
>    tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
>    tomcat/trunk/webapps/docs/changelog.xml
>
>Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
>URL:
>http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=1145383&r1=1145382&r2=1145383&view=diff
>==============================================================================
>--- tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
>(original)
>+++ tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Mon
>Jul 11 22:27:06 2011
>@@ -1240,6 +1240,13 @@ public class NioEndpoint extends Abstrac
>                         sd.pos += written;
>                         sd.length -= written;
>                         attachment.access();
>+                    } else {
>+                        // Unusual not to be unable to transfer any
>bytes
There really are too many negations for me to understand the meaning of the above, but I think you mean "able".

Regards
 Felix
>+                        // Check the length was set correctly
>+                        if (sd.fchannel.size() <= sd.pos) {
>+                            throw new IOException("Sendfile configured
>to " +
>+                                    "send more data than was
>available");
>+                        }
>                     }
>                 }
>                 if ( sd.length <= 0 && sc.getOutboundRemaining()<=0) {
>



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