You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by yl...@apache.org on 2020/12/14 17:53:48 UTC

svn commit: r1884429 - /httpd/httpd/trunk/server/core_filters.c

Author: ylavic
Date: Mon Dec 14 17:53:48 2020
New Revision: 1884429

URL: http://svn.apache.org/viewvc?rev=1884429&view=rev
Log:
core_input_filter: BRIGADE_NORMALIZE() can be called with an empty brigade.

So make it a noop in this case, without dereferencing the sentinel (i.e.
change its do{}while to a while{}).

Modified:
    httpd/httpd/trunk/server/core_filters.c

Modified: httpd/httpd/trunk/server/core_filters.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/core_filters.c?rev=1884429&r1=1884428&r2=1884429&view=diff
==============================================================================
--- httpd/httpd/trunk/server/core_filters.c (original)
+++ httpd/httpd/trunk/server/core_filters.c Mon Dec 14 17:53:48 2020
@@ -61,17 +61,13 @@
 #define BRIGADE_NORMALIZE(b) \
 do { \
     apr_bucket *e = APR_BRIGADE_FIRST(b); \
-    do {  \
+    while (e != APR_BRIGADE_SENTINEL(b)) { \
+        apr_bucket *next = APR_BUCKET_NEXT(e); \
         if (e->length == 0 && !APR_BUCKET_IS_METADATA(e)) { \
-            apr_bucket *d; \
-            d = APR_BUCKET_NEXT(e); \
             apr_bucket_delete(e); \
-            e = d; \
         } \
-        else { \
-            e = APR_BUCKET_NEXT(e); \
-        } \
-    } while (!APR_BRIGADE_EMPTY(b) && (e != APR_BRIGADE_SENTINEL(b))); \
+        e = next; \
+    } \
 } while (0)
 
 /* we know core's module_index is 0 */
@@ -127,9 +123,6 @@ apr_status_t ap_core_input_filter(ap_fil
     }
     else {
         ap_filter_reinstate_brigade(f, ctx->bb, NULL);
-        if (APR_BRIGADE_EMPTY(ctx->bb)) {
-            return APR_EOF;
-        }
     }
 
     /* ### This is bad. */