httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From grega...@apache.org
Subject cvs commit: httpd-2.0/server core.c
Date Mon, 11 Nov 2002 19:57:58 GMT
gregames    2002/11/11 11:57:58

  Modified:    server   core.c
  Log:
  prevent seg faults when running with Electric Fence.
  
  The "more" brigade (created by apr_brigade_split after seeing a FLUSH bucket)
  was in the deferred_write_pool.  d_w_p is cleared, "more" is copied into b,
  then the while loop test for APR_BRIGADE_EMPTY(b) blows up.
  
  Revision  Changes    Path
  1.222     +23 -1     httpd-2.0/server/core.c
  
  Index: core.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/core.c,v
  retrieving revision 1.221
  retrieving revision 1.222
  diff -u -r1.221 -r1.222
  --- core.c	8 Nov 2002 19:20:04 -0000	1.221
  +++ core.c	11 Nov 2002 19:57:58 -0000	1.222
  @@ -3665,6 +3665,7 @@
   static apr_status_t core_output_filter(ap_filter_t *f, apr_bucket_brigade *b)
   {
       apr_status_t rv;
  +    apr_bucket_brigade *more;  /* definition moved to foil a gdb bug */
       conn_rec *c = f->c;
       core_net_rec *net = f->ctx;
       core_output_filter_ctx_t *ctx = net->out_ctx;
  @@ -3690,7 +3691,7 @@
           apr_bucket *e;
   
           /* tail of brigade if we need another pass */
  -        apr_bucket_brigade *more = NULL;
  +        more = NULL;
   
           /* one group of iovecs per pass over the brigade */
           apr_size_t nvec = 0;
  @@ -4003,6 +4004,27 @@
            * created the resource
            */
           if (ctx->deferred_write_pool) {
  +            if (more) {
  +                if (APR_BRIGADE_EMPTY(more)) {
  +                    /* the usual case - prevent the next loop iteration
  +                     * from referencing a brigade which lives in a
  +                     * cleared pool
  +                     */
  +                    more = NULL;
  +                }
  +                else {
  +                    /* change the lifetime of "more" to the connection's
  +                     * lifetime
  +                     *
  +                     * XXX a shorter lifetime would be better for long-running
  +                     * keep-alive connections...might be able to use the
  +                     * input brigade's pool
  +                     */
  +                    apr_bucket_brigade *tmp_more = more;
  +                    more = NULL;
  +                    ap_save_brigade(f, &more, &tmp_more, c->pool);
  +                }
  +            }
               apr_pool_clear(ctx->deferred_write_pool);  
           }
           if (rv != APR_SUCCESS) {
  
  
  

Mime
View raw message