[master] c611b9a61 Guard against OA_GZIPBITS streaming race
Poul-Henning Kamp
phk at FreeBSD.org
Tue May 21 07:25:09 UTC 2019
commit c611b9a615b2d035c8631febc9f60efb339af67e
Author: Reza Naghibi <reza at naghibi.com>
Date: Wed Feb 13 10:45:40 2019 -0500
Guard against OA_GZIPBITS streaming race
diff --git a/bin/varnishd/cache/cache_gzip.c b/bin/varnishd/cache/cache_gzip.c
index a48715055..9be9b1d7c 100644
--- a/bin/varnishd/cache/cache_gzip.c
+++ b/bin/varnishd/cache/cache_gzip.c
@@ -292,6 +292,10 @@ vdp_gunzip_init(struct req *req, void **priv)
ssize_t dl;
uint64_t u;
+ CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
+ CHECK_OBJ_NOTNULL(req->objcore, OBJCORE_MAGIC);
+ CHECK_OBJ_ORNULL(req->objcore->boc, BOC_MAGIC);
+
vg = VGZ_NewGunzip(req->vsl, "U D -");
AN(vg);
if (vgz_getmbuf(vg)) {
@@ -306,6 +310,10 @@ vdp_gunzip_init(struct req *req, void **priv)
req->resp_len = -1;
+ /* OA_GZIPBITS is not stable yet */
+ if (req->objcore->boc)
+ return (0);
+
p = ObjGetAttr(req->wrk, req->objcore, OA_GZIPBITS, &dl);
if (p != NULL && dl == 32) {
u = vbe64dec(p + 24);
More information about the varnish-commit
mailing list