[master] 3cf1648 Make gzip data corruption on fetch a non-assert fetch error.

Poul-Henning Kamp phk at varnish-cache.org
Mon Mar 28 11:17:17 CEST 2011


commit 3cf16486c61fca2e4502c0fa34297e29fcb4b4dc
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Mar 28 09:16:57 2011 +0000

    Make gzip data corruption on fetch a non-assert fetch error.

diff --git a/bin/varnishd/cache_gzip.c b/bin/varnishd/cache_gzip.c
index 50f8c83..61b083c 100644
--- a/bin/varnishd/cache_gzip.c
+++ b/bin/varnishd/cache_gzip.c
@@ -584,11 +584,16 @@ vfp_testgzip_bytes(struct sess *sp, struct http_conn *htc, ssize_t bytes)
 		while (!VGZ_IbufEmpty(vg)) {
 			VGZ_Obuf(vg, ibuf, sizeof ibuf);
 			i = VGZ_Gunzip(vg, &dp, &dl);
-			assert(i == Z_OK || i == Z_STREAM_END);
+			if (i != Z_OK && i != Z_STREAM_END) {
+				WSP(sp, SLT_FetchError,
+				    "Invalid Gzip data: %s", vg->vz.msg);
+				return (-1);
+			}
 		}
 	}
-	if (i == Z_OK || i == Z_STREAM_END)
+	if (i == Z_STREAM_END)
 		return (1);
+	WSP(sp, SLT_FetchError, "Incomplete Gzip data (not STREAM_END)");
 	return (-1);
 }
 



More information about the varnish-commit mailing list