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

Weibin Yao yaoweibin at gmail.com
Fri Feb 22 08:17:10 CET 2013


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-dev/attachments/20130222/6bb9f977/attachment.html>


More information about the varnish-dev mailing list