Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-5]: src/sys/lib/libz Pull up revision 1.4 (requested by fvdl):
details: https://anonhg.NetBSD.org/src/rev/ce2e71226f98
branches: netbsd-1-5
changeset: 492971:ce2e71226f98
user: he <he%NetBSD.org@localhost>
date: Wed Mar 20 23:18:22 2002 +0000
description:
Pull up revision 1.4 (requested by fvdl):
Upgrade libz to 1.1.4 due to a possible security bug.
diffstat:
sys/lib/libz/adler32.c | 7 +-
sys/lib/libz/crc32.c | 8 +-
sys/lib/libz/infblock.c | 13 +++-
sys/lib/libz/infblock.h | 16 +++---
sys/lib/libz/infcodes.c | 14 +----
sys/lib/libz/infcodes.h | 10 ++--
sys/lib/libz/inffast.c | 51 +++++++++++++-------
sys/lib/libz/inffast.h | 6 +-
sys/lib/libz/inflate.c | 4 +-
sys/lib/libz/inftrees.h | 10 ++--
sys/lib/libz/infutil.c | 4 +-
sys/lib/libz/infutil.h | 6 +-
sys/lib/libz/zconf.h | 14 ++--
sys/lib/libz/zlib.h | 117 +++++++++++++++++++++++++++--------------------
14 files changed, 153 insertions(+), 127 deletions(-)
diffs (truncated from 857 to 300 lines):
diff -r 6308f65b5455 -r ce2e71226f98 sys/lib/libz/adler32.c
--- a/sys/lib/libz/adler32.c Wed Mar 20 23:18:19 2002 +0000
+++ b/sys/lib/libz/adler32.c Wed Mar 20 23:18:22 2002 +0000
@@ -1,11 +1,10 @@
-/* $NetBSD: adler32.c,v 1.3 1998/11/01 21:28:51 tron Exp $ */
-
+/* $NetBSD: adler32.c,v 1.3.22.1 2002/03/20 23:18:22 he Exp $ */
/* adler32.c -- compute the Adler-32 checksum of a data stream
- * Copyright (C) 1995-1998 Mark Adler
+ * Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
-/* @(#) Id */
+/* @(#) $Id: adler32.c,v 1.3.22.1 2002/03/20 23:18:22 he Exp $ */
#include "zlib.h"
diff -r 6308f65b5455 -r ce2e71226f98 sys/lib/libz/crc32.c
--- a/sys/lib/libz/crc32.c Wed Mar 20 23:18:19 2002 +0000
+++ b/sys/lib/libz/crc32.c Wed Mar 20 23:18:22 2002 +0000
@@ -1,11 +1,11 @@
-/* $NetBSD: crc32.c,v 1.3 1998/11/01 21:28:51 tron Exp $ */
+/* $NetBSD: crc32.c,v 1.3.22.1 2002/03/20 23:18:22 he Exp $ */
/* crc32.c -- compute the CRC-32 of a data stream
- * Copyright (C) 1995-1998 Mark Adler
+ * Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
-/* @(#) Id */
+/* @(#) $Id: crc32.c,v 1.3.22.1 2002/03/20 23:18:22 he Exp $ */
#include "zlib.h"
@@ -15,7 +15,7 @@
local int crc_table_empty = 1;
local uLongf crc_table[256];
-local void make_crc_table OF((void));
+local void make_crc_table __P((void));
/*
Generate a table for a byte-wise 32-bit CRC calculation on the polynomial:
diff -r 6308f65b5455 -r ce2e71226f98 sys/lib/libz/infblock.c
--- a/sys/lib/libz/infblock.c Wed Mar 20 23:18:19 2002 +0000
+++ b/sys/lib/libz/infblock.c Wed Mar 20 23:18:22 2002 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: infblock.c,v 1.3 1998/11/01 21:28:51 tron Exp $ */
+/* $NetBSD: infblock.c,v 1.3.22.1 2002/03/20 23:18:23 he Exp $ */
/* infblock.c -- interpret and process block types to last block
- * Copyright (C) 1995-1998 Mark Adler
+ * Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -251,10 +251,12 @@
&s->sub.trees.tb, s->hufts, z);
if (t != Z_OK)
{
- ZFREE(z, s->sub.trees.blens);
r = t;
if (r == Z_DATA_ERROR)
+ {
+ ZFREE(z, s->sub.trees.blens);
s->mode = BAD;
+ }
LEAVE
}
s->sub.trees.index = 0;
@@ -315,11 +317,13 @@
t = inflate_trees_dynamic(257 + (t & 0x1f), 1 + ((t >> 5) & 0x1f),
s->sub.trees.blens, &bl, &bd, &tl, &td,
s->hufts, z);
- ZFREE(z, s->sub.trees.blens);
if (t != Z_OK)
{
if (t == (uInt)Z_DATA_ERROR)
+ {
+ ZFREE(z, s->sub.trees.blens);
s->mode = BAD;
+ }
r = t;
LEAVE
}
@@ -331,6 +335,7 @@
}
s->sub.decode.codes = c;
}
+ ZFREE(z, s->sub.trees.blens);
s->mode = CODES;
case CODES:
UPDATE
diff -r 6308f65b5455 -r ce2e71226f98 sys/lib/libz/infblock.h
--- a/sys/lib/libz/infblock.h Wed Mar 20 23:18:19 2002 +0000
+++ b/sys/lib/libz/infblock.h Wed Mar 20 23:18:22 2002 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: infblock.h,v 1.3 1998/11/01 21:28:51 tron Exp $ */
+/* $NetBSD: infblock.h,v 1.3.22.1 2002/03/20 23:18:23 he Exp $ */
/* infblock.h -- header to use infblock.c
- * Copyright (C) 1995-1998 Mark Adler
+ * Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -13,29 +13,29 @@
struct inflate_blocks_state;
typedef struct inflate_blocks_state FAR inflate_blocks_statef;
-extern inflate_blocks_statef * inflate_blocks_new OF((
+extern inflate_blocks_statef * inflate_blocks_new __P((
z_streamp z,
check_func c, /* check function */
uInt w)); /* window size */
-extern int inflate_blocks OF((
+extern int inflate_blocks __P((
inflate_blocks_statef *,
z_streamp ,
int)); /* initial return code */
-extern void inflate_blocks_reset OF((
+extern void inflate_blocks_reset __P((
inflate_blocks_statef *,
z_streamp ,
uLongf *)); /* check value on output */
-extern int inflate_blocks_free OF((
+extern int inflate_blocks_free __P((
inflate_blocks_statef *,
z_streamp));
-extern void inflate_set_dictionary OF((
+extern void inflate_set_dictionary __P((
inflate_blocks_statef *s,
const Bytef *d, /* dictionary */
uInt n)); /* dictionary length */
-extern int inflate_blocks_sync_point OF((
+extern int inflate_blocks_sync_point __P((
inflate_blocks_statef *s));
diff -r 6308f65b5455 -r ce2e71226f98 sys/lib/libz/infcodes.c
--- a/sys/lib/libz/infcodes.c Wed Mar 20 23:18:19 2002 +0000
+++ b/sys/lib/libz/infcodes.c Wed Mar 20 23:18:22 2002 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: infcodes.c,v 1.3 1998/11/03 15:49:39 tron Exp $ */
+/* $NetBSD: infcodes.c,v 1.3.22.1 2002/03/20 23:18:23 he Exp $ */
/* infcodes.c -- process literals and length/distance pairs
- * Copyright (C) 1995-1998 Mark Adler
+ * Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -198,15 +198,9 @@
Tracevv((stderr, "inflate: distance %u\n", c->sub.copy.dist));
c->mode = COPY;
case COPY: /* o: copying bytes in window, waiting for space */
-#ifndef __TURBOC__ /* Turbo C bug for following expression */
- f = (uInt)(q - s->window) < c->sub.copy.dist ?
- s->end - (c->sub.copy.dist - (q - s->window)) :
- q - c->sub.copy.dist;
-#else
f = q - c->sub.copy.dist;
- if ((uInt)(q - s->window) < c->sub.copy.dist)
- f = s->end - (c->sub.copy.dist - (uInt)(q - s->window));
-#endif
+ while (f < s->window) /* modulo window size-"while" instead */
+ f += s->end - s->window; /* of "if" handles invalid distances */
while (c->len)
{
NEEDOUT
diff -r 6308f65b5455 -r ce2e71226f98 sys/lib/libz/infcodes.h
--- a/sys/lib/libz/infcodes.h Wed Mar 20 23:18:19 2002 +0000
+++ b/sys/lib/libz/infcodes.h Wed Mar 20 23:18:22 2002 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: infcodes.h,v 1.3 1998/11/03 15:49:39 tron Exp $ */
+/* $NetBSD: infcodes.h,v 1.3.22.1 2002/03/20 23:18:23 he Exp $ */
/* infcodes.h -- header to use infcodes.c
- * Copyright (C) 1995-1998 Mark Adler
+ * Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -13,17 +13,17 @@
struct inflate_codes_state;
typedef struct inflate_codes_state FAR inflate_codes_statef;
-extern inflate_codes_statef *inflate_codes_new OF((
+extern inflate_codes_statef *inflate_codes_new __P((
uInt, uInt,
inflate_huft *, inflate_huft *,
z_streamp ));
-extern int inflate_codes OF((
+extern int inflate_codes __P((
inflate_blocks_statef *,
z_streamp ,
int));
-extern void inflate_codes_free OF((
+extern void inflate_codes_free __P((
inflate_codes_statef *,
z_streamp ));
diff -r 6308f65b5455 -r ce2e71226f98 sys/lib/libz/inffast.c
--- a/sys/lib/libz/inffast.c Wed Mar 20 23:18:19 2002 +0000
+++ b/sys/lib/libz/inffast.c Wed Mar 20 23:18:22 2002 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: inffast.c,v 1.3 1998/11/01 21:28:51 tron Exp $ */
+/* $NetBSD: inffast.c,v 1.3.22.1 2002/03/20 23:18:23 he Exp $ */
/* inffast.c -- process literals and length/distance pairs fast
- * Copyright (C) 1995-1998 Mark Adler
+ * Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -95,28 +95,41 @@
/* do the copy */
m -= c;
- if ((uInt)(q - s->window) >= d) /* offset before dest */
- { /* just copy */
- r = q - d;
- *q++ = *r++; c--; /* minimum count is three, */
- *q++ = *r++; c--; /* so unroll loop a little */
- }
- else /* else offset after destination */
+ r = q - d;
+ if (r < s->window) /* wrap if needed */
{
- e = d - (uInt)(q - s->window); /* bytes from offset to end */
- r = s->end - e; /* pointer to offset */
- if (c > e) /* if source crosses, */
+ do {
+ r += s->end - s->window; /* force pointer in window */
+ } while (r < s->window); /* covers invalid distances */
+ e = s->end - r;
+ if (c > e)
{
- c -= e; /* copy to end of window */
+ c -= e; /* wrapped copy */
+ do {
+ *q++ = *r++;
+ } while (--e);
+ r = s->window;
do {
- *q++ = *r++;
- } while (--e);
- r = s->window; /* copy rest from start of window */
+ *q++ = *r++;
+ } while (--c);
+ }
+ else /* normal copy */
+ {
+ *q++ = *r++; c--;
+ *q++ = *r++; c--;
+ do {
+ *q++ = *r++;
+ } while (--c);
}
}
- do { /* copy all or what's left */
- *q++ = *r++;
- } while (--c);
+ else /* normal copy */
+ {
+ *q++ = *r++; c--;
+ *q++ = *r++; c--;
+ do {
+ *q++ = *r++;
+ } while (--c);
+ }
break;
}
else if ((e & 64) == 0)
diff -r 6308f65b5455 -r ce2e71226f98 sys/lib/libz/inffast.h
--- a/sys/lib/libz/inffast.h Wed Mar 20 23:18:19 2002 +0000
+++ b/sys/lib/libz/inffast.h Wed Mar 20 23:18:22 2002 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: inffast.h,v 1.3 1998/11/03 15:49:39 tron Exp $ */
+/* $NetBSD: inffast.h,v 1.3.22.1 2002/03/20 23:18:23 he Exp $ */
/* inffast.h -- header to use inffast.c
- * Copyright (C) 1995-1998 Mark Adler
+ * Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -10,7 +10,7 @@
subject to change. Applications should only use zlib.h.
*/
-extern int inflate_fast OF((
+extern int inflate_fast __P((
Home |
Main Index |
Thread Index |
Old Index