r2187 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Mon Oct 29 13:06:34 CET 2007


Author: phk
Date: 2007-10-29 13:06:34 +0100 (Mon, 29 Oct 2007)
New Revision: 2187

Modified:
   trunk/varnish-cache/bin/varnishd/cache_hash.c
   trunk/varnish-cache/bin/varnishd/hash_classic.c
Log:
More checks, trying to find pointer tango


Modified: trunk/varnish-cache/bin/varnishd/cache_hash.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_hash.c	2007-10-29 10:22:22 UTC (rev 2186)
+++ trunk/varnish-cache/bin/varnishd/cache_hash.c	2007-10-29 12:06:34 UTC (rev 2187)
@@ -73,6 +73,7 @@
 	struct storage *st;
 
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
+	CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC);
 	w = sp->wrk;
 
 	if (w->nobjhead == NULL) {
@@ -87,7 +88,8 @@
 	if (w->nobj == NULL) {
 		st = STV_alloc(sp, params->mem_workspace);
 		XXXAN(st);
-		w->nobj = (void *)st->ptr;
+		assert(st->size > sizeof *w->nobj);
+		w->nobj = (void *)st->ptr; /* XXX: align ? */
 		st->len = sizeof *w->nobj;
 		memset(w->nobj, 0, sizeof *w->nobj);
 		w->nobj->objstore = st;
@@ -122,6 +124,9 @@
 	unsigned u, v;
 	const char *b;
 
+	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
+	CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC);
+	CHECK_OBJ_NOTNULL(obj, OBJHEAD_MAGIC);
 	i = sp->lhashptr - obj->hashlen;
 	if (i)
 		return (i);

Modified: trunk/varnish-cache/bin/varnishd/hash_classic.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/hash_classic.c	2007-10-29 10:22:22 UTC (rev 2186)
+++ trunk/varnish-cache/bin/varnishd/hash_classic.c	2007-10-29 12:06:34 UTC (rev 2187)
@@ -128,6 +128,9 @@
 	unsigned u, v;
 	int i;
 
+	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
+	CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC);
+	CHECK_OBJ_NOTNULL(sp->http, HTTP_MAGIC);
 	CHECK_OBJ_ORNULL(noh, OBJHEAD_MAGIC);
 
 	digest = ~0U;




More information about the varnish-commit mailing list