[Patch] Avoid varnish assert failure when inflating corrupt compressed ESI response

Dag Haavi Finstad daghf at varnish-software.com
Fri Feb 22 11:27:25 CET 2013


Hi Weibin

I'm pretty sure this is #1184, which has since been fixed in both master[1]
and 3.0[2].

Thanks though!


[1]:
https://www.varnish-cache.org/trac/changeset/7c784d5c9d2dd959a5ea1a1bea5f7bbb4173437d
[2]:
https://www.varnish-cache.org/trac/changeset/e837c4bcd26218489576af899f563c66e6b0511f


On Fri, Feb 22, 2013 at 8:17 AM, Weibin Yao <yaoweibin at gmail.com> wrote:

> Hi folks,
>
> This is a small patch, it fixes the segment fault caused by the failure
> assertion with the error gunzip return value.
>
> I don't know if this patch is sufficient, it seems work for me.
>
> Thanks.
>
> diff --git a/bin/varnishd/cache_esi_fetch.c
> b/bin/varnishd/cache_esi_fetch.c
> index ab86ac8..e3f80f3 100644
> --- a/bin/varnishd/cache_esi_fetch.c
> +++ b/bin/varnishd/cache_esi_fetch.c
> @@ -270,8 +270,9 @@ vfp_esi_bytes_gg(struct sess *sp, struct http_conn
> *htc, size_t bytes)
>                 do {
>                         VGZ_Obuf(sp->wrk->vgz_rx, ibuf2, sizeof ibuf2);
>                         i = VGZ_Gunzip(sp->wrk->vgz_rx, &dp, &dl);
> -                       /* XXX: check i */
> -                       assert(i >= VGZ_OK);
> +                       if (i < VGZ_OK) {
> +                               return (-1);
> +                       }
>                         vef->bufp = ibuf2;
>                         if (dl > 0)
>                                 VEP_parse(sp, ibuf2, dl);
>
>
> --
> Weibin Yao
> Developer @ Server Platform Team of Taobao
>
> _______________________________________________
> varnish-dev mailing list
> varnish-dev at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev
>



-- 
  <http://www.varnish-software.com>  *Dag Haavi Finstad*
Developer | Varnish Software AS
Phone: +47 21 98 92 60
We Make Websites Fly!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-dev/attachments/20130222/a1ea550d/attachment.html>


More information about the varnish-dev mailing list