You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rp...@apache.org on 2008/01/08 17:38:15 UTC

svn commit: r610061 - /httpd/httpd/trunk/modules/http/http_filters.c

Author: rpluem
Date: Tue Jan  8 08:38:14 2008
New Revision: 610061

URL: http://svn.apache.org/viewvc?rev=610061&view=rev
Log:
* Address two edge cases:
  1. The brigade contains only META buckets.
  2. The last data bucket is of zero length.

Pointed out by: niq

Modified:
    httpd/httpd/trunk/modules/http/http_filters.c

Modified: httpd/httpd/trunk/modules/http/http_filters.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http/http_filters.c?rev=610061&r1=610060&r2=610061&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http/http_filters.c (original)
+++ httpd/httpd/trunk/modules/http/http_filters.c Tue Jan  8 08:38:14 2008
@@ -139,11 +139,15 @@
             break;
         }
     }
+    /* We only had META buckets in this brigade */
+    if (e == APR_BRIGADE_SENTINEL(b)) {
+        return APR_EAGAIN;
+    }
     rv = apr_bucket_read(e, &lineend, &len, APR_BLOCK_READ);
     if (rv != APR_SUCCESS) {
         return rv;
     }
-    if (lineend[len - 1] != APR_ASCII_LF) {
+    if ((len == 0) || (lineend[len - 1] != APR_ASCII_LF)) {
         return APR_EAGAIN;
     }
     /* Line is complete. So reset ctx->linesize for next round. */



Re: svn commit: r610061 - /httpd/httpd/trunk/modules/http/http_filters.c

Posted by Ruediger Pluem <rp...@apache.org>.

On 01/08/2008 06:25 PM, Nick Kew wrote:
> On Tue, 08 Jan 2008 16:38:15 -0000
> rpluem@apache.org wrote:
> 
>> +    if ((len == 0) || (lineend[len - 1] != APR_ASCII_LF)) {
>>          return APR_EAGAIN;
>>      }
> 
> Isn't that a potential infinite loop?  The zero-length bucket
> will still be there next time round.

No. This is outside of the for loop and next time we have a new bucket brigade.

Regards

RĂ¼diger


Re: svn commit: r610061 - /httpd/httpd/trunk/modules/http/http_filters.c

Posted by Nick Kew <ni...@webthing.com>.
On Tue, 08 Jan 2008 16:38:15 -0000
rpluem@apache.org wrote:

> +    if ((len == 0) || (lineend[len - 1] != APR_ASCII_LF)) {
>          return APR_EAGAIN;
>      }

Isn't that a potential infinite loop?  The zero-length bucket
will still be there next time round.

if (len == 0) { remove(b); try p->prev; }


-- 
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/