With current CVS code, prefork, APR_POOL_DEBUG, Linux, and
ElectricFence I readily hit a segfault on the APR_BRIGADE_NORMALIZE()
call in core input filter.  It segfaulted because the brigade was
empty.  With the following patch I can't seem to hit a segfault
anymore.

Perhaps the brigade shouldn't be empty for some reason...

If this is really the right issue, APR_BRIGADE_NORMALIZE() should
probably have the logic to check for an empty brigade.

Index: server/core.c
===================================================================
RCS file: /home/cvs/httpd-2.0/server/core.c,v
retrieving revision 1.128
diff -u -r1.128 core.c
--- server/core.c       8 Jan 2002 17:07:19 -0000       1.128
+++ server/core.c       11 Jan 2002 13:57:30 -0000
@@ -2879,7 +2879,9 @@
     }
 
     /* ### This is bad. */
-    APR_BRIGADE_NORMALIZE(ctx->b);
+    if (!APR_BRIGADE_EMPTY(ctx->b)) {
+        APR_BRIGADE_NORMALIZE(ctx->b);
+    }
 
     /* ### AP_MODE_PEEK is a horrific name for this mode because we also
      * eat any CRLFs that we see.  That's not the obvious intention of

-- 
Jeff Trawick | [EMAIL PROTECTED] | PGP public key at web site:
       http://www.geocities.com/SiliconValley/Park/9289/
             Born in Roswell... married an alien...

Reply via email to