Commit e2dd3884 authored by Dridi Boukelmoune's avatar Dridi Boukelmoune

vtc: Bring r01576 back

Adapted to the pcre2 change, and (manually) tested both with and
without jit compilation and various tweaks to trigger both match
and depth limits.

Closes #3658
parent a80a50ca
varnishtest "Test recursive regexp's fail before consuming all the stack"
# Use 64bit defaults also on 32bit
varnish v1 -cliok "param.set workspace_client 64k"
varnish v1 -cliok "param.set http_req_size 32k"
# If you want to play around, uncomment the next lines and adjust
# the length of the ABAB strings below to suit your needs.
# Better yet: Rewrite your regexps to avoid this madness.
# Tweaks you may add to this test:
# varnish v1 -cliok "param.set thread_pool_stack 48k"
# varnish v1 -cliok "param.set pcre2_match_limit 100"
# varnish v1 -cliok "param.set pcre2_depth_limit 10000"
# varnish v1 -cliok "param.set pcre2_jit_compilation off"
# Approximate formula for FreeBSD/amd64:
# pcre2_depth_limit = thread_pool_stack * 2 - 9
varnish v1 -vcl+backend {
backend proforma none;
sub vcl_recv {
return (synth(200));
}
sub vcl_synth {
# shamelessly copied from "bugzilla77 at gmail dot com"
# https://bugs.php.net/bug.php?id=70110
if (req.url ~ "^/(A{1,2}B)+$") {
set resp.http.found = "1";
}
}
} -start
# This should succeed with default params and JIT/no-JIT
client c1 {
txreq -url "/ABAABABAABABABAB"
rxresp
expect resp.status == 200
expect resp.http.found == 1
} -run
logexpect l1 -v v1 {
expect * * VCL_Error "(match|depth) limit exceeded"
} -start
# This should fail with default params and JIT/no-JIT
client c1 {
txreq -url "/${string,repeat,8192,AB}"
expect_close
} -run
logexpect l1 -wait
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment