Commit Graph

34 Commits

Author SHA1 Message Date
Mark Adler
b9ae6f0079 Add crc32_z() and adler32_z() functions with size_t lengths. 2016-12-31 17:50:52 -08:00
Mark Adler
bedea2483b Clean up and comment the use of local for static. 2016-10-26 10:25:10 -07:00
Mark Adler
e08118c401 Note the violation of the strict aliasing rule in crc32.c.
See the comment for more details. This is in response to an issue
raised as a result of a security audit of the zlib code by Trail
of Bits and TrustInSoft, in support of the Mozilla Foundation.
2016-10-03 22:33:26 -07:00
Mark Adler
d1d577490c Avoid pre-decrement of pointer in big-endian CRC calculation.
There was a small optimization for PowerPCs to pre-increment a
pointer when accessing a word, instead of post-incrementing. This
required prefacing the loop with a decrement of the pointer,
possibly pointing before the object passed. This is not compliant
with the C standard, for which decrementing a pointer before its
allocated memory is undefined. When tested on a modern PowerPC
with a modern compiler, the optimization no longer has any effect.
Due to all that, and per the recommendation of a security audit of
the zlib code by Trail of Bits and TrustInSoft, in support of the
Mozilla Foundation, this "optimization" was removed, in order to
avoid the possibility of undefined behavior.
2016-09-28 20:48:38 -07:00
Mark Adler
6c9bd474aa Fix type mismatch between get_crc_table() and crc_table.
crc_table is made using a four-byte integer (when that can be
determined).  However get_crc_table() returned a pointer to an
unsigned long, which could be eight bytes.  This fixes that by
creating a new z_crc_t type for the crc_table.

This type is also used for the BYFOUR crc calculations that depend
on a four-byte type.  The four-byte type can now be determined by
./configure, which also solves a problem where ./configure --solo
would never use BYFOUR.  No the Z_U4 #define indicates that four-
byte integer was found either by ./configure or by zconf.h.
2012-04-29 16:18:12 -07:00
Mark Adler
94acb3c1a0 zlib 1.2.6.1 2012-02-12 14:20:33 -08:00
Mark Adler
7d45cf5a1d Use optimized byte swap operations for Microsoft and GNU [Snyder]. 2012-02-11 00:26:38 -08:00
Mark Adler
f9e4edc996 Avoid library header include in crc32.c for Z_SOLO.
crc32.c was #including limits.h in order to find a four-byte integer
type.  It was doing this even if Z_SOLO were defined, violating the
intent of Z_SOLO, which is to include no library headers and require
no library functions.  Now crc32.c obeys the intent of Z_SOLO, but
with the downside that crc32() will be slower than when not compiled
with Z_SOLO.  This can be remedied manually by typedefing u4 to a
known four-byte unsigned integer type, and #defining BYFOUR in
crc32.c.
2012-02-01 23:55:29 -08:00
Mark Adler
10daf0d4d7 zlib 1.2.5.1 2011-09-11 11:04:49 -07:00
Mark Adler
9712272c78 zlib 1.2.5 2011-09-09 23:35:10 -07:00
Mark Adler
05d47d2627 zlib 1.2.4.1 2011-09-09 23:34:22 -07:00
Mark Adler
f6194ef39a zlib 1.2.3.4 2011-09-09 23:26:40 -07:00
Mark Adler
639be99788 zlib 1.2.3.3 2011-09-09 23:26:29 -07:00
Mark Adler
9c3a583021 zlib 1.2.2.4 2011-09-09 23:24:52 -07:00
Mark Adler
6b8233bfe0 zlib 1.2.2.3 2011-09-09 23:24:43 -07:00
Mark Adler
0484693e17 zlib 1.2.2.2 2011-09-09 23:24:33 -07:00
Mark Adler
9811b53dd9 zlib 1.2.2.1 2011-09-09 23:24:24 -07:00
Mark Adler
79fbcdc939 zlib 1.2.2 2011-09-09 23:24:02 -07:00
Mark Adler
7a6955760b zlib 1.2.1.2 2011-09-09 23:23:45 -07:00
Mark Adler
4b5a43a219 zlib 1.2.0.5 2011-09-09 23:22:37 -07:00
Mark Adler
086e982175 zlib 1.2.0.4 2011-09-09 23:22:30 -07:00
Mark Adler
8e34b3a802 zlib 1.2.0.2 2011-09-09 23:22:10 -07:00
Mark Adler
7c2a874e50 zlib 1.2.0 2011-09-09 23:21:47 -07:00
Mark Adler
a383133c4e zlib 1.1.4 2011-09-09 23:20:42 -07:00
Mark Adler
b8c9ecb076 zlib 1.0.9 2011-09-09 23:19:21 -07:00
Mark Adler
6759211ad8 zlib 1.0.8 2011-09-09 23:18:57 -07:00
Mark Adler
7850e4e406 zlib 1.0.7 2011-09-09 23:17:33 -07:00
Mark Adler
423eb40306 zlib 1.0.1 2011-09-09 23:14:39 -07:00
Mark Adler
8a2acbffc8 zlib 1.0-pre 2011-09-09 23:13:27 -07:00
Mark Adler
56bcb184fa zlib 0.99 2011-09-09 23:11:37 -07:00
Mark Adler
23c69f1069 zlib 0.94 2011-09-09 23:09:18 -07:00
Mark Adler
6b834a58bd zlib 0.93 2011-09-09 23:08:28 -07:00
Mark Adler
64b2e89203 zlib 0.9 2011-09-09 23:06:52 -07:00
Mark Adler
bcf78a2097 zlib 0.71 2011-09-09 22:36:31 -07:00