Commit 1f6827bc authored by Geoff Simmons's avatar Geoff Simmons

add an integrity check when retrieving task data from the current ws

parent 2654795d
Pipeline #66 skipped
......@@ -240,6 +240,13 @@ ws_alloc_digest(VRT_CTX, const size_t digestsz,
/* Objects */
static inline void
WS_Contains(struct ws * const restrict ws, const void * const restrict ptr,
const size_t len)
{
assert((char *)ptr >= ws->s && (char *)(ptr + len) <= ws->e);
}
static struct digest_task *
get_task(const struct vrt_ctx * const restrict ctx,
const struct vmod_blobdigest_digest * const restrict h)
......@@ -249,8 +256,10 @@ get_task(const struct vrt_ctx * const restrict ctx,
priv = VRT_priv_task(ctx, (void *)h);
AN(priv);
if (priv->priv != NULL)
if (priv->priv != NULL) {
CAST_OBJ(task, priv->priv, VMOD_BLOBDIGEST_DIGEST_TASK_MAGIC);
WS_Contains(ctx->ws, task, sizeof(hash_ctx));
}
else {
if ((task = WS_Alloc(ctx->ws, sizeof(struct digest_task)))
== NULL)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment