Return-Path: X-Original-To: apmail-tomcat-dev-archive@www.apache.org Delivered-To: apmail-tomcat-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A870B43BD for ; Mon, 11 Jul 2011 22:27:31 +0000 (UTC) Received: (qmail 69843 invoked by uid 500); 11 Jul 2011 22:27:30 -0000 Delivered-To: apmail-tomcat-dev-archive@tomcat.apache.org Received: (qmail 69686 invoked by uid 500); 11 Jul 2011 22:27:30 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 69676 invoked by uid 99); 11 Jul 2011 22:27:29 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Jul 2011 22:27:29 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Jul 2011 22:27:27 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 9B0D723888FD for ; Mon, 11 Jul 2011 22:27:06 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1145383 - in /tomcat/trunk: java/org/apache/tomcat/util/net/NioEndpoint.java webapps/docs/changelog.xml Date: Mon, 11 Jul 2011 22:27:06 -0000 To: dev@tomcat.apache.org From: markt@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110711222706.9B0D723888FD@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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) + + Protect against infinite loops in the HTTP NIO connector if sendfile is + configured to send more data than is available in the file. (markt) + --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org For additional commands, e-mail: dev-help@tomcat.apache.org