summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/lib/libz/Makefile8
-rw-r--r--sys/lib/libz/infblock.c18
-rw-r--r--sys/lib/libz/infcodes.c10
-rw-r--r--sys/lib/libz/inffast.c10
-rw-r--r--sys/lib/libz/inflate.c22
-rw-r--r--sys/lib/libz/inftrees.c32
6 files changed, 91 insertions, 9 deletions
diff --git a/sys/lib/libz/Makefile b/sys/lib/libz/Makefile
index 7916a53b512..d4e3405b8df 100644
--- a/sys/lib/libz/Makefile
+++ b/sys/lib/libz/Makefile
@@ -1,16 +1,16 @@
-# $OpenBSD: Makefile,v 1.3 1998/09/08 04:07:46 millert Exp $
+# $OpenBSD: Makefile,v 1.4 2003/12/16 03:26:54 deraadt Exp $
# $NetBSD: Makefile,v 1.2 1997/01/22 01:36:30 cgd Exp $
LIB= z
NOPIC=
NOPROFILE=
-CPPFLAGS+= -I. ${ZCPPFLAGS} -D_ZLIB_PRIVATE
+CPPFLAGS+= -I. ${ZCPPFLAGS} -D_ZLIB_PRIVATE -DSLOW -DSMALL
# files to be copied down from libz.
-LIBZSRCS= adler32.c crc32.c infblock.c infcodes.c inffast.c \
+LIBZSRCS= adler32.c crc32.c infblock.c infcodes.c \
inflate.c inftrees.c infutil.c
-LIBZHDRS= infblock.h infcodes.h inffast.h inffixed.h inftrees.h infutil.h \
+LIBZHDRS= infblock.h infcodes.h inffixed.h inftrees.h infutil.h \
zconf.h zlib.h zutil.h
# Other stuff
diff --git a/sys/lib/libz/infblock.c b/sys/lib/libz/infblock.c
index a47c923136d..33b644e59f4 100644
--- a/sys/lib/libz/infblock.c
+++ b/sys/lib/libz/infblock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: infblock.c,v 1.9 2002/03/12 00:26:30 millert Exp $ */
+/* $OpenBSD: infblock.c,v 1.10 2003/12/16 03:26:54 deraadt Exp $ */
/* infblock.c -- interpret and process block types to last block
* Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
@@ -175,7 +175,11 @@ int r;
case 3: /* illegal */
DUMPBITS(3)
s->mode = BAD;
+#ifdef SMALL
+ z->msg = "error";
+#else
z->msg = (char*)"invalid block type";
+#endif
r = Z_DATA_ERROR;
LEAVE
}
@@ -185,7 +189,11 @@ int r;
if ((((~b) >> 16) & 0xffff) != (b & 0xffff))
{
s->mode = BAD;
+#ifdef SMALL
+ z->msg = "error";
+#else
z->msg = (char*)"invalid stored block lengths";
+#endif
r = Z_DATA_ERROR;
LEAVE
}
@@ -218,7 +226,11 @@ int r;
if ((t & 0x1f) > 29 || ((t >> 5) & 0x1f) > 29)
{
s->mode = BAD;
+#ifdef SMALL
+ z->msg = "error";
+#else
z->msg = (char*)"too many length or distance symbols";
+#endif
r = Z_DATA_ERROR;
LEAVE
}
@@ -290,7 +302,11 @@ int r;
{
ZFREE(z, s->sub.trees.blens);
s->mode = BAD;
+#ifdef SMALL
+ z->msg = "error";
+#else
z->msg = (char*)"invalid bit length repeat";
+#endif
r = Z_DATA_ERROR;
LEAVE
}
diff --git a/sys/lib/libz/infcodes.c b/sys/lib/libz/infcodes.c
index 6c26c7039a2..9ca685db025 100644
--- a/sys/lib/libz/infcodes.c
+++ b/sys/lib/libz/infcodes.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: infcodes.c,v 1.6 2002/03/12 00:26:30 millert Exp $ */
+/* $OpenBSD: infcodes.c,v 1.7 2003/12/16 03:26:54 deraadt Exp $ */
/* infcodes.c -- process literals and length/distance pairs
* Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
@@ -154,7 +154,11 @@ int r;
break;
}
c->mode = BADCODE; /* invalid code */
+#ifdef SMALL
+ z->msg = "error";
+#else
z->msg = (char*)"invalid literal/length code";
+#endif
r = Z_DATA_ERROR;
LEAVE
case LENEXT: /* i: getting length extra (have base) */
@@ -186,7 +190,11 @@ int r;
break;
}
c->mode = BADCODE; /* invalid code */
+#ifdef SMALL
+ z->msg = "error";
+#else
z->msg = (char*)"invalid distance code";
+#endif
r = Z_DATA_ERROR;
LEAVE
case DISTEXT: /* i: getting distance extra */
diff --git a/sys/lib/libz/inffast.c b/sys/lib/libz/inffast.c
index c033947b04d..0e66e4a5a47 100644
--- a/sys/lib/libz/inffast.c
+++ b/sys/lib/libz/inffast.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: inffast.c,v 1.6 2002/03/12 00:26:30 millert Exp $ */
+/* $OpenBSD: inffast.c,v 1.7 2003/12/16 03:26:54 deraadt Exp $ */
/* inffast.c -- process literals and length/distance pairs fast
* Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
@@ -138,7 +138,11 @@ z_streamp z;
}
else
{
+#ifdef SMALL
+ z->msg = "error";
+#else
z->msg = (char*)"invalid distance code";
+#endif
UNGRAB
UPDATE
return Z_DATA_ERROR;
@@ -169,7 +173,11 @@ z_streamp z;
}
else
{
+#ifdef SMALL
+ z->msg = "error";
+#else
z->msg = (char*)"invalid literal/length code";
+#endif
UNGRAB
UPDATE
return Z_DATA_ERROR;
diff --git a/sys/lib/libz/inflate.c b/sys/lib/libz/inflate.c
index 6480283114e..de5422ceeec 100644
--- a/sys/lib/libz/inflate.c
+++ b/sys/lib/libz/inflate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: inflate.c,v 1.6 2002/03/12 00:26:30 millert Exp $ */
+/* $OpenBSD: inflate.c,v 1.7 2003/12/16 03:26:54 deraadt Exp $ */
/* inflate.c -- zlib interface to inflate modules
* Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
@@ -166,14 +166,22 @@ int f;
if (((z->state->sub.method = NEXTBYTE) & 0xf) != Z_DEFLATED)
{
z->state->mode = BAD;
+#ifdef SMALL
+ z->msg = "error";
+#else
z->msg = (char*)"unknown compression method";
+#endif
z->state->sub.marker = 5; /* can't try inflateSync */
break;
}
if ((z->state->sub.method >> 4) + 8 > z->state->wbits)
{
z->state->mode = BAD;
+#ifdef SMALL
+ z->msg = "error";
+#else
z->msg = (char*)"invalid window size";
+#endif
z->state->sub.marker = 5; /* can't try inflateSync */
break;
}
@@ -184,7 +192,11 @@ int f;
if (((z->state->sub.method << 8) + b) % 31)
{
z->state->mode = BAD;
+#ifdef SMALL
+ z->msg = "error";
+#else
z->msg = (char*)"incorrect header check";
+#endif
z->state->sub.marker = 5; /* can't try inflateSync */
break;
}
@@ -215,7 +227,11 @@ int f;
return Z_NEED_DICT;
case DICT0:
z->state->mode = BAD;
+#ifdef SMALL
+ z->msg = "error";
+#else
z->msg = (char*)"need dictionary";
+#endif
z->state->sub.marker = 0; /* can try inflateSync */
return Z_STREAM_ERROR;
case BLOCKS:
@@ -257,7 +273,11 @@ int f;
if (z->state->sub.check.was != z->state->sub.check.need)
{
z->state->mode = BAD;
+#ifdef SMALL
+ z->msg = "error";
+#else
z->msg = (char*)"incorrect data check";
+#endif
z->state->sub.marker = 5; /* can't try inflateSync */
break;
}
diff --git a/sys/lib/libz/inftrees.c b/sys/lib/libz/inftrees.c
index 3c40bc26b9a..1d3effeed89 100644
--- a/sys/lib/libz/inftrees.c
+++ b/sys/lib/libz/inftrees.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: inftrees.c,v 1.9 2002/03/12 00:26:30 millert Exp $ */
+/* $OpenBSD: inftrees.c,v 1.10 2003/12/16 03:26:54 deraadt Exp $ */
/* inftrees.c -- generate Huffman trees for efficient decoding
* Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
@@ -11,8 +11,10 @@
# define BUILDFIXED /* non ANSI compilers may not accept inffixed.h */
#endif
+#ifndef SMALL
const char inflate_copyright[] =
" inflate 1.1.4 Copyright 1995-2002 Mark Adler ";
+#endif
/*
If you use the zlib library in a product, an acknowledgment is welcome
in the documentation of your product. If for some reason you cannot
@@ -307,10 +309,18 @@ z_streamp z; /* for messages */
r = huft_build(c, 19, 19, (uIntf*)Z_NULL, (uIntf*)Z_NULL,
tb, bb, hp, &hn, v);
if (r == Z_DATA_ERROR)
+#ifdef SMALL
+ z->msg = "error";
+#else
z->msg = (char*)"oversubscribed dynamic bit lengths tree";
+#endif
else if (r == Z_BUF_ERROR || *bb == 0)
{
+#ifdef SMALL
+ z->msg = "error";
+#else
z->msg = (char*)"incomplete dynamic bit lengths tree";
+#endif
r = Z_DATA_ERROR;
}
ZFREE(z, v);
@@ -342,10 +352,18 @@ z_streamp z; /* for messages */
if (r != Z_OK || *bl == 0)
{
if (r == Z_DATA_ERROR)
+#ifdef SMALL
+ z->msg = "error";
+#else
z->msg = (char*)"oversubscribed literal/length tree";
+#endif
else if (r != Z_MEM_ERROR)
{
+#ifdef SMALL
+ z->msg = "error";
+#else
z->msg = (char*)"incomplete literal/length tree";
+#endif
r = Z_DATA_ERROR;
}
ZFREE(z, v);
@@ -357,18 +375,30 @@ z_streamp z; /* for messages */
if (r != Z_OK || (*bd == 0 && nl > 257))
{
if (r == Z_DATA_ERROR)
+#ifdef SMALL
+ z->msg = "error";
+#else
z->msg = (char*)"oversubscribed distance tree";
+#endif
else if (r == Z_BUF_ERROR) {
#ifdef PKZIP_BUG_WORKAROUND
r = Z_OK;
}
#else
+#ifdef SMALL
+ z->msg = "error";
+#else
z->msg = (char*)"incomplete distance tree";
+#endif
r = Z_DATA_ERROR;
}
else if (r != Z_MEM_ERROR)
{
+#ifdef SMALL
+ z->msg = "error";
+#else
z->msg = (char*)"empty distance tree with lengths";
+#endif
r = Z_DATA_ERROR;
}
ZFREE(z, v);