varnish / varnish-modules

Collection of Varnish Cache modules (vmods) by Varnish Software
Other
182 stars 86 forks source link

fix(vmod_var): gracefully handle WS_Alloc failures #198

Closed dhamidi closed 2 years ago

dhamidi commented 2 years ago

The assumption that WS_Alloc always returns a non-NULL value is not true, which can lead to the AN(v) following the call to WS_Alloc in vmod_var to kill the varnish child process, resulting in a loss of the cache.

Instead of panicking due to a failed assertion, this commit introduces a check of the return value of WS_Alloc and fails the request in case not enough memory was available for allocating a new variable.

Follow-up for #196