Apply by doing:
        cd /usr/src
        patch -p0 < 017_libz.patch

And then rebuild and install libz:
        cd lib/libz
        make obj
        make depend
        make
        make install

Index: lib/libz/infback.c
===================================================================
RCS file: /cvs/src/lib/libz/infback.c,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -p -r1.2 -r1.2.2.1
--- lib/libz/infback.c	17 Dec 2003 00:28:19 -0000	1.2
+++ lib/libz/infback.c	28 Aug 2004 16:21:46 -0000	1.2.2.1
@@ -446,6 +446,9 @@ void FAR *out_desc;
                 }
             }
 
+            if (state->mode == BAD)
+                break;
+
             /* build code tables */
             state->next = state->codes;
             state->lencode = (code const FAR *)(state->next);
Index: lib/libz/inflate.c
===================================================================
RCS file: /cvs/src/lib/libz/inflate.c,v
retrieving revision 1.6
retrieving revision 1.6.2.1
diff -u -p -r1.6 -r1.6.2.1
--- lib/libz/inflate.c	17 Dec 2003 00:28:19 -0000	1.6
+++ lib/libz/inflate.c	28 Aug 2004 16:21:46 -0000	1.6.2.1
@@ -909,6 +909,9 @@ int flush;
                         state->lens[state->have++] = (unsigned short)len;
                 }
             }
+
+            if (state->mode == BAD)
+                break;
 
             /* build code tables */
             state->next = state->codes;
