[master] c14650c Fix assertion in HTTP_create()

Nils Goroll nils.goroll at uplex.de
Mon May 28 08:43:23 UTC 2018


commit c14650ca2c380ae4d8869299977d2161caf98e5e
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Mon May 28 10:37:05 2018 +0200

    Fix assertion in HTTP_create()
    
    For the case that http_max_hdr is not a multiple of the pointer
    size.
    
    Ref #2690

diff --git a/bin/varnishd/cache/cache_http.c b/bin/varnishd/cache/cache_http.c
index 6c3e2ce..8e41d37 100644
--- a/bin/varnishd/cache/cache_http.c
+++ b/bin/varnishd/cache/cache_http.c
@@ -155,7 +155,7 @@ HTTP_create(void *p, uint16_t nhttp, unsigned len)
 	hp->hd = (void*)(hp + 1);
 	hp->shd = nhttp;
 	hp->hdf = (void*)(hp->hd + nhttp);
-	assert((unsigned char*)p + len == hp->hdf + nhttp);
+	assert((unsigned char*)p + len == hp->hdf + PRNDUP(nhttp));
 	return (hp);
 }
 
diff --git a/bin/varnishtest/tests/r02690.vtc b/bin/varnishtest/tests/r02690.vtc
new file mode 100644
index 0000000..fd13305
--- /dev/null
+++ b/bin/varnishtest/tests/r02690.vtc
@@ -0,0 +1,129 @@
+varnishtest "Check http_max_hdr values"
+
+server s1 -repeat 17 {
+	rxreq
+	txresp
+} -start
+
+varnish v1 -vcl+backend {
+	sub vcl_recv {
+		return(pass);
+	}
+} -start
+
+client c1 {
+	txreq
+	rxresp
+} -run
+
+varnish v1 -cliok {param.set http_max_hdr 33}
+
+client c1 {
+	txreq
+	rxresp
+} -run
+
+varnish v1 -cliok {param.set http_max_hdr 34}
+
+client c1 {
+	txreq
+	rxresp
+} -run
+
+varnish v1 -cliok {param.set http_max_hdr 35}
+
+client c1 {
+	txreq
+	rxresp
+} -run
+
+varnish v1 -cliok {param.set http_max_hdr 36}
+
+client c1 {
+	txreq
+	rxresp
+} -run
+
+varnish v1 -cliok {param.set http_max_hdr 37}
+
+client c1 {
+	txreq
+	rxresp
+} -run
+
+varnish v1 -cliok {param.set http_max_hdr 38}
+
+client c1 {
+	txreq
+	rxresp
+} -run
+
+varnish v1 -cliok {param.set http_max_hdr 39}
+
+client c1 {
+	txreq
+	rxresp
+} -run
+
+varnish v1 -cliok {param.set http_max_hdr 40}
+
+client c1 {
+	txreq
+	rxresp
+} -run
+
+varnish v1 -cliok {param.set http_max_hdr 41}
+
+client c1 {
+	txreq
+	rxresp
+} -run
+
+varnish v1 -cliok {param.set http_max_hdr 42}
+
+client c1 {
+	txreq
+	rxresp
+} -run
+
+varnish v1 -cliok {param.set http_max_hdr 43}
+
+client c1 {
+	txreq
+	rxresp
+} -run
+
+varnish v1 -cliok {param.set http_max_hdr 44}
+
+client c1 {
+	txreq
+	rxresp
+} -run
+
+varnish v1 -cliok {param.set http_max_hdr 45}
+
+client c1 {
+	txreq
+	rxresp
+} -run
+
+varnish v1 -cliok {param.set http_max_hdr 46}
+
+client c1 {
+	txreq
+	rxresp
+} -run
+
+varnish v1 -cliok {param.set http_max_hdr 47}
+
+client c1 {
+	txreq
+	rxresp
+} -run
+
+varnish v1 -cliok {param.set http_max_hdr 48}
+
+client c1 {
+	txreq
+	rxresp
+} -run


More information about the varnish-commit mailing list