[master] 1289746 Tighten asserts related to pipelined rxbuf.
Poul-Henning Kamp
phk at FreeBSD.org
Mon Feb 27 10:44:06 CET 2017
commit 12897464bb1e97469b50d639e1ba2b107185353a
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Feb 27 09:03:30 2017 +0000
Tighten asserts related to pipelined rxbuf.
diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c
index 1c0c6d7..5bf7d81 100644
--- a/bin/varnishd/cache/cache_session.c
+++ b/bin/varnishd/cache/cache_session.c
@@ -192,6 +192,8 @@ HTC_RxInit(struct http_conn *htc, struct ws *ws)
htc->rxbuf_b = ws->f;
htc->rxbuf_e = ws->f;
if (htc->pipeline_b != NULL) {
+ AN(htc->pipeline_e);
+ assert(WS_Inside(ws, htc->pipeline_b, htc->pipeline_e));
l = htc->pipeline_e - htc->pipeline_b;
assert(l > 0);
assert(l <= ws->r - htc->rxbuf_b);
@@ -210,12 +212,12 @@ HTC_RxPipeline(struct http_conn *htc, void *p)
if (p == NULL || (char*)p == htc->rxbuf_e) {
htc->pipeline_b = NULL;
htc->pipeline_e = NULL;
- return;
+ } else {
+ assert((char*)p >= htc->rxbuf_b);
+ assert((char*)p < htc->rxbuf_e);
+ htc->pipeline_b = p;
+ htc->pipeline_e = htc->rxbuf_e;
}
- assert((char*)p >= htc->rxbuf_b);
- assert((char*)p < htc->rxbuf_e);
- htc->pipeline_b = p;
- htc->pipeline_e = htc->rxbuf_e;
}
/*----------------------------------------------------------------------
More information about the varnish-commit
mailing list