[master] 80d78148c In resp_default_filter_list, check for objcore before using it

Nils Goroll nils.goroll at uplex.de
Mon Aug 21 19:33:06 UTC 2023


commit 80d78148cb1c17eefbec70a51ea3efca03d5bd6d
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Mon Aug 21 21:32:12 2023 +0200

    In resp_default_filter_list, check for objcore before using it
    
    Fixes #3968

diff --git a/bin/varnishd/cache/cache_vrt_filter.c b/bin/varnishd/cache/cache_vrt_filter.c
index bf45372d1..bcd7ed1b3 100644
--- a/bin/varnishd/cache/cache_vrt_filter.c
+++ b/bin/varnishd/cache/cache_vrt_filter.c
@@ -397,11 +397,12 @@ resp_default_filter_list(void *arg, struct vsb *vsb)
 
 	CAST_OBJ_NOTNULL(req, arg, REQ_MAGIC);
 
-	if (!req->disable_esi &&
+	if (!req->disable_esi && req->objcore != NULL &&
 	    ObjHasAttr(req->wrk, req->objcore, OA_ESIDATA))
 		VSB_cat(vsb, " esi");
 
 	if (cache_param->http_gzip_support &&
+	    req->objcore != NULL &&
 	    ObjCheckFlag(req->wrk, req->objcore, OF_GZIPED) &&
 	    !RFC2616_Req_Gzip(req->http))
 		VSB_cat(vsb, " gunzip");
diff --git a/bin/varnishtest/tests/m00048.vtc b/bin/varnishtest/tests/m00048.vtc
index f67f72a23..60440cdf9 100644
--- a/bin/varnishtest/tests/m00048.vtc
+++ b/bin/varnishtest/tests/m00048.vtc
@@ -79,3 +79,28 @@ client c1 -repeat 2 {
 	rxresp
 	expect resp.body == "Cbagb Snpgb, Pnrfne Genafvg!"
 } -run
+
+varnish v1 -vcl {
+	import debug;
+	backend none none;
+
+	sub vcl_recv {
+		return (synth(200));
+	}
+	sub vcl_synth {
+		set resp.body = "Ponto Facto, Caesar Transit!";
+		if (req.http.Rot13) {
+			set resp.filters += "rot13 debug.pedantic";
+		}
+		return (deliver);
+	}
+}
+
+client c1 -repeat 2 {
+	txreq
+	rxresp
+	expect resp.body == "Ponto Facto, Caesar Transit!"
+	txreq -hdr "Rot13: please"
+	rxresp
+	expect resp.body == "Cbagb Snpgb, Pnrfne Genafvg!"
+} -run


More information about the varnish-commit mailing list