]> err.no Git - varnish/commitdiff
More checks, trying to find pointer tango
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 29 Oct 2007 12:06:34 +0000 (12:06 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 29 Oct 2007 12:06:34 +0000 (12:06 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2187 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache_hash.c
varnish-cache/bin/varnishd/hash_classic.c

index 869b4bf6d98cc38be456685adf768c304f14e45a..c93a38b8b450703e3bab5b44b8357068d20cbf7c 100644 (file)
@@ -73,6 +73,7 @@ HSH_Prealloc(struct sess *sp)
        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 @@ HSH_Prealloc(struct sess *sp)
        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 @@ HSH_Compare(const struct sess *sp, const struct objhead *obj)
        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);
index bdee5314ada95832026747562613db3fdbf6dac6..75082ea01a2ca5f26792f18a237c16defef6ad91 100644 (file)
@@ -128,6 +128,9 @@ hcl_lookup(const struct sess *sp, struct objhead *noh)
        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;