[master] c9463f1b3 Fix ubsan complaints when using gcc

Nils Goroll nils.goroll at uplex.de
Fri Feb 7 22:43:05 UTC 2025


commit c9463f1b354a3a9e22bae5d3bf5a387c38a46898
Author: Steven Wojcik <wojcikjsteven at gmail.com>
Date:   Sun Mar 17 22:40:20 2024 -0400

    Fix ubsan complaints when using gcc

diff --git a/bin/varnishd/cache/cache_req.c b/bin/varnishd/cache/cache_req.c
index 42e2b93b0..7be842d5e 100644
--- a/bin/varnishd/cache/cache_req.c
+++ b/bin/varnishd/cache/cache_req.c
@@ -173,7 +173,7 @@ Req_New(struct sess *sp)
 	p = (void*)PRNDUP(p + sizeof(*req->vfc));
 
 	req->vdc = (void*)p;
-	memset(req->vdc, 0, sizeof *req->vdc);
+	ZERO_OBJ(req->vdc, sizeof *req->vdc);
 	p = (void*)PRNDUP(p + sizeof(*req->vdc));
 
 	req->htc = (void*)p;
diff --git a/bin/varnishtest/vtc.c b/bin/varnishtest/vtc.c
index 80f04b501..2ac436700 100644
--- a/bin/varnishtest/vtc.c
+++ b/bin/varnishtest/vtc.c
@@ -562,6 +562,8 @@ exec_file(const char *fn, const char *script, const char *tmpdir,
 	struct vsb *vsb;
 	const char *p;
 
+	AN(tmpdir);
+
 	(void)signal(SIGPIPE, SIG_IGN);
 
 	PTOK(pthread_mutex_init(&vtc_vrnd_mtx, NULL));


More information about the varnish-commit mailing list