[Varnish] #251: segfault on regsub on missing http header

Varnish varnish-bugs at projects.linpro.no
Wed Jun 18 17:26:43 CEST 2008


#251: segfault on regsub on missing http header
----------------------+-----------------------------------------------------
 Reporter:  wichert   |       Owner:  phk  
     Type:  defect    |      Status:  new  
 Priority:  normal    |   Milestone:       
Component:  varnishd  |     Version:  trunk
 Severity:  normal    |    Keywords:       
----------------------+-----------------------------------------------------
 Observed in current trunk. I have a regular expression in vcl_fetch to
 filter incoming cookies:

 {{{
 if (req.url ~ "VirtualHostRoot/?$" && ! req.http.cookie ~ "__ac" ) {
     set req.http.cookie = regsub(req.http.cookie,
 ".*mainchain=%22([^%22]*%22).*", "mainchain=$1");
 }
 }}}

 When a request without a cookie header comes in varnishlog only shows
 this:
 {{{
     0 CLI          - Rd vcl.use boot
     0 CLI          - Wr 0 200
     0 CLI          - Rd start
     0 Debug        - "Acceptor is epoll"
     0 CLI          - Wr 0 200
     0 WorkThread   - 0x6fcdb104 start
    13 SessionOpen  c 10.7.0.113 51006
     0 CLI          - Rd vcl.load boot ./vcl.1P9zoqAU.o
     0 CLI          - Wr 0 200 Loaded "./vcl.1P9zoqAU.o" as "boot"
 }}}

 a strace of the varnish processes shows varnish segfaulting. I am guessing
 regsub gets a NULL input string and does not handle that correctly.

-- 
Ticket URL: <http://varnish.projects.linpro.no/ticket/251>
Varnish <http://varnish.projects.linpro.no/>
The Varnish HTTP Accelerator


More information about the varnish-bugs mailing list