[Varnish] #1557: regsuball() doesn't honor lookahead assertion on repeated strings
    Varnish 
    varnish-bugs at varnish-cache.org
       
    Thu Jul 24 16:43:53 CEST 2014
    
    
  
#1557: regsuball() doesn't honor lookahead assertion on repeated strings
--------------------------------------+----------------------
 Reporter:  varnish@…                 |       Type:  defect
   Status:  new                       |   Priority:  normal
Milestone:                            |  Component:  varnishd
  Version:  trunk                     |   Severity:  normal
 Keywords:  lookahead pcre regsuball  |
--------------------------------------+----------------------
 Hi Varnish-Team,
 the function regsuball doesn't honor lookahead assertion in a regular
 expression correctly, if a regex matches against sequenced or repeated
 strings.
 Example:
 If you strip some query strings and match for different query strings in
 one regex and the query strings are sequenced one after another, not all
 strings matches:
 {{{
 sub vcl_backend_response {
     set bereq.url = "/?id=23&name=foo&age=42";
     set beresp.http.foo = regsuball(bereq.url,
 "(?<=[&\?])(id|name|age)=[^&]+(?:&|$)", "");
 }
 }}}
 The expected result should be:
 {{{
 EXPECT resp.http.foo == "/?"
 }}}
 Result is:
 {{{
 resp.http.foo /?name=foo&
 }}}
 This error occures in bin/varnishd/cache/cache_vrt_re.c, in function
 VRT_regsub. The matched substring is some kind of cutted off instead of
 setting the offset for the ongoing pcre_exec runs. So the pcre engine
 could never test for lookahead assertion, since the former string isn't
 there anymore. This results in a misbehavior and a not correctly executed
 match.
 Best regards,
 Martin
-- 
Ticket URL: <https://www.varnish-cache.org/trac/ticket/1557>
Varnish <https://varnish-cache.org/>
The Varnish HTTP Accelerator
    
    
More information about the varnish-bugs
mailing list