[master] 398d7c6 Ensure that we never call a VDP with a zero length unless we are done.
Poul-Henning Kamp
phk at FreeBSD.org
Tue Jul 29 20:47:24 CEST 2014
commit 398d7c6e3b2abf5ccc3b1def91a862636058fa6e
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Jul 29 18:44:17 2014 +0000
Ensure that we never call a VDP with a zero length unless we are done.
Fixes #1561
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 315ec4c..37bc660 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -833,6 +833,7 @@ VDP_bytes(struct req *req, enum vdp_action act, const void *ptr, ssize_t len)
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
+ assert(act > VDP_NULL || len > 0);
/* Call the present layer, while pointing to the next layer down */
i = req->vdp_nxt--;
assert(i >= 0 && i < N_VDPS);
diff --git a/bin/varnishd/cache/cache_obj.c b/bin/varnishd/cache/cache_obj.c
index 00d5bc9..ba0979b 100644
--- a/bin/varnishd/cache/cache_obj.c
+++ b/bin/varnishd/cache/cache_obj.c
@@ -77,9 +77,12 @@ ObjIter(struct objiter *oi, void **p, ssize_t *l)
oi->st = VTAILQ_FIRST(&oi->obj->body->list);
else
oi->st = VTAILQ_NEXT(oi->st, list);
+ while(oi->st != NULL && oi->st->len == 0)
+ oi->st = VTAILQ_NEXT(oi->st, list);
if (oi->st != NULL) {
*p = oi->st->ptr;
*l = oi->st->len;
+ assert(*l > 0);
return (OIS_DATA);
}
return (OIS_DONE);
More information about the varnish-commit
mailing list