[master] df9bc1860 Make WS_Allocated() assert that pointers are not in the free part of WS

Dridi Boukelmoune dridi at varni.sh
Wed Nov 30 08:53:18 UTC 2022


On Wed, Nov 30, 2022 at 8:48 AM Poul-Henning Kamp <phk at freebsd.org> wrote:
>
>
> commit df9bc1860ff4d4c659aca71ec9ebcd4bdd0d31f1
> Author: Poul-Henning Kamp <phk at FreeBSD.org>
> Date:   Wed Nov 30 08:47:25 2022 +0000
>
>     Make WS_Allocated() assert that pointers are not in the free part of WS
>
> diff --git a/bin/varnishd/cache/cache_ws.c b/bin/varnishd/cache/cache_ws.c
> index d327ad757..d6ff67370 100644
> --- a/bin/varnishd/cache/cache_ws.c
> +++ b/bin/varnishd/cache/cache_ws.c
> @@ -71,6 +71,7 @@ WS_Allocated(const struct ws *ws, const void *ptr, ssize_t len)
>         WS_Assert(ws);
>         if (len < 0)
>                 len = strlen(p) + 1;
> +       assert(!(p > ws->f && p <= ws->e));
>         return (p >= ws->s && (p + len) <= ws->f);
>  }

Just in case you were wondering, the workspace emulator already guarantees this.

Cheers,
Dridi


More information about the varnish-commit mailing list