aboutsummaryrefslogtreecommitdiff
path: root/FAQ
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2011-09-09 23:21:57 -0700
committerMark Adler <madler@alumni.caltech.edu>2011-09-09 23:21:57 -0700
commit13a294f044ef0a89b2dcbfbb5d4d4c792673348e (patch)
treed9b377b4d8c00633c3da4e96659bfba9b08287f2 /FAQ
parent7c2a874e50b871d04fbd19501f7b42cff55e5abc (diff)
downloadzlib-13a294f044ef0a89b2dcbfbb5d4d4c792673348e.tar.gz
zlib-13a294f044ef0a89b2dcbfbb5d4d4c792673348e.tar.bz2
zlib-13a294f044ef0a89b2dcbfbb5d4d4c792673348e.zip
zlib 1.2.0.1v1.2.0.1
Diffstat (limited to 'FAQ')
-rw-r--r--FAQ105
1 files changed, 67 insertions, 38 deletions
diff --git a/FAQ b/FAQ
index abf680c..2a8247c 100644
--- a/FAQ
+++ b/FAQ
@@ -1,5 +1,5 @@
1 1
2 Frequently Asked Questions about zlib 2 Frequently Asked Questions about zlib
3 3
4 4
5If your question is not there, please check the zlib home page 5If your question is not there, please check the zlib home page
@@ -90,13 +90,14 @@ The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html
90 ./configure -s 90 ./configure -s
91 make 91 make
92 92
9314. Why does "make test" fail on Mac OS X? 9314. How do I install a shared zlib library on Unix?
94 94
95 Mac OS X already includes zlib as a shared library, and so -lz links the 95 make install
96 shared library instead of the one that the "make" compiled. The two are 96
97 incompatible due to different compile-time options. Simply change the -lz 97 However, many flavors of Unix come with a shared zlib already installed.
98 in the Makefile to libz.a, and it will use the compiled library instead 98 Before going to the trouble of compiling a shared version of zlib and
99 of the shared one and the "make test" will succeed. 99 trying to install it, you may want to check if it's already there! If you
100 can #include <zlib.h>, it's there. The -lz option will probably link to it.
100 101
10115. I have a question about OttoPDF 10215. I have a question about OttoPDF
102 103
@@ -108,8 +109,8 @@ The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html
108 The compress and deflate functions produce data in the zlib format, which 109 The compress and deflate functions produce data in the zlib format, which
109 is different and incompatible with the gzip format. The gz* functions in 110 is different and incompatible with the gzip format. The gz* functions in
110 zlib on the other hand use the gzip format. Both the zlib and gzip 111 zlib on the other hand use the gzip format. Both the zlib and gzip
111 formats use the same compressed data format, but have different headers 112 formats use the same compressed data format internally, but have different
112 and trailers. 113 headers and trailers around the compressed data.
113 114
11417. Ok, so why are there two different formats? 11517. Ok, so why are there two different formats?
115 116
@@ -127,12 +128,13 @@ The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html
12719. Is zlib thread-safe? 12819. Is zlib thread-safe?
128 129
129 Yes. However any library routines that zlib uses and any application- 130 Yes. However any library routines that zlib uses and any application-
130 provided memory allocation routines must also be thread-safe. Of course, 131 provided memory allocation routines must also be thread-safe. zlib's gz*
131 you should only operate on any given zlib or gzip stream from a single 132 functions use stdio library routines, and most of zlib's functions use the
132 thread. zlib's gz* functions use stdio library routines, and most of 133 library memory allocation routines by default. zlib's Init functions allow
133 zlib's functions use the library memory allocation routines by default. 134 for the application to provide custom memory allocation routines.
134 zlib's Init functions allow for the application to provide custom memory 135
135 allocation routines. 136 Of course, you should only operate on any given zlib or gzip stream from a
137 single thread at a time.
136 138
13720. Can I use zlib in my commercial application? 13920. Can I use zlib in my commercial application?
138 140
@@ -142,24 +144,44 @@ The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html
142 144
143 No. Please read the license in zlib.h. 145 No. Please read the license in zlib.h.
144 146
14522. Will zlib work on a big-endian or little-endian architecture, and can I 14722. The license says that altered source versions must be "plainly marked". So
148 what exactly do I need to do to meet that requirement?
149
150 You need to append something the ZLIB_VERSION string in zlib.h. For
151 example, if the version of the base zlib you are altering is "1.2.3", then
152 you could change the string to "1.2.3-fred-mods-v3". You should not change
153 it to "1.2.4" or "1.2.3.1" since the zlib authors would like to reserve
154 those forms of the version for their own use.
155
156 For altered source distributions, you should also note the origin and
157 nature of the changes in zlib.h, as well as in ChangeLog and README, along
158 with the dates of the alterations. The origin should include at least your
159 name (or your company's name), and an email address to contact for help or
160 issues with the library.
161
162 Note that distributing a compiled zlib library along with zlib.h and
163 zconf.h is also a source distribution, and so you should change
164 ZLIB_VERSION and note the origin and nature of the changes in zlib.h as you
165 would for a full source distribution.
166
16723. Will zlib work on a big-endian or little-endian architecture, and can I
146 exchange compressed data between them? 168 exchange compressed data between them?
147 169
148 Yes and yes. 170 Yes and yes.
149 171
15023. Will zlib work on a 64-bit machine? 17224. Will zlib work on a 64-bit machine?
151 173
152 It should. It has been tested on 64-bit machines, and has no dependence 174 It should. It has been tested on 64-bit machines, and has no dependence
153 on any data types being limited to 32-bits in length. If you have any 175 on any data types being limited to 32-bits in length. If you have any
154 difficulties, please provide a complete problem report to zlib@gzip.org 176 difficulties, please provide a complete problem report to zlib@gzip.org
155 177
15624. Will zlib decompress data from the PKWare Data Compression Library? 17825. Will zlib decompress data from the PKWare Data Compression Library?
157 179
158 No. The PKWare DCL uses a completely different compressed data format 180 No. The PKWare DCL uses a completely different compressed data format
159 than does PKZIP and zlib. However, you can look in zlib's contrib/blast 181 than does PKZIP and zlib. However, you can look in zlib's contrib/blast
160 directory for a possible solution to your problem. 182 directory for a possible solution to your problem.
161 183
16225. Can I access data randomly in a compressed stream? 18426. Can I access data randomly in a compressed stream?
163 185
164 No, not without some preparation. If when compressing you periodically 186 No, not without some preparation. If when compressing you periodically
165 use Z_FULL_FLUSH, carefully write all the pending data at those points, 187 use Z_FULL_FLUSH, carefully write all the pending data at those points,
@@ -167,76 +189,83 @@ The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html
167 at those points. You have to be careful to not use Z_FULL_FLUSH too 189 at those points. You have to be careful to not use Z_FULL_FLUSH too
168 often, since it can significantly degrade compression. 190 often, since it can significantly degrade compression.
169 191
17026. Does zlib work on MVS, OS/390, CICS, etc.? 19227. Does zlib work on MVS, OS/390, CICS, etc.?
171 193
172 We don't know for sure. We have heard occasional reports of success on 194 We don't know for sure. We have heard occasional reports of success on
173 these systems. If you do use it on one of these, please provide us with 195 these systems. If you do use it on one of these, please provide us with
174 a report, instructions, and patches that we can reference when we get 196 a report, instructions, and patches that we can reference when we get
175 these questions. Thanks. 197 these questions. Thanks.
176 198
17727. Is there some simpler, easier to read version of inflate I can look at 19928. Is there some simpler, easier to read version of inflate I can look at
178 to understand the deflate format? 200 to understand the deflate format?
179 201
180 First off, you should read RFC 1951. Second, yes. Look in zlib's 202 First off, you should read RFC 1951. Second, yes. Look in zlib's
181 contrib/puff directory. 203 contrib/puff directory.
182 204
18328. Does zlib infringe on any patents? 20529. Does zlib infringe on any patents?
184 206
185 As far as we know, no. In fact, that was originally the whole point behind 207 As far as we know, no. In fact, that was originally the whole point behind
186 zlib. Look here for some more information: 208 zlib. Look here for some more information:
187 209
188 http://www.gzip.org/#faq11 210 http://www.gzip.org/#faq11
189 211
19029. Can zlib work with greater than 4 GB of data? 21230. Can zlib work with greater than 4 GB of data?
191 213
192 Yes. inflate() and deflate() will process any amount of data correctly. 214 Yes. inflate() and deflate() will process any amount of data correctly.
193 However the strm.total_in and strm_total_out counters may be limited to 215 However the strm.total_in and strm_total_out counters may be limited to
194 4 GB. The user can easily set up their own counters updated after each 216 4 GB. The application can easily set up its own counters updated after each
195 call of inflate() or deflate() to count beyond 4 GB. compress() and 217 call of inflate() or deflate() to count beyond 4 GB. compress() and
196 uncompress() may be limited to 4 GB, since they operate in a single 218 uncompress() may be limited to 4 GB, since they operate in a single call
197 call using unsigned long lengths. gzseek() may be limited to 4 GB 219 using unsigned long lengths. gzseek() and gztell() may be limited to 4 GB
198 depending on how zlib is compiled. 220 depending on how zlib is compiled.
199 221
20030. Does zlib have any security vulnerabilities? 22231. Does zlib have any security vulnerabilities?
201 223
202 The only one that we are aware of is potentially in gzprintf(). If zlib 224 The only one that we are aware of is potentially in gzprintf(). If zlib
203 is compiled to use sprintf() or vsprintf(), then there is no protection 225 is compiled to use sprintf() or vsprintf(), then there is no protection
204 against a buffer overflow of a 4K string space, other than the caller of 226 against a buffer overflow of a 4K string space, other than the caller of
205 gzprintf() assuring that the output will not exceed 4K. On the other 227 gzprintf() assuring that the output will not exceed 4K. On the other
206 hand, if zlib is compiled to use snprintf() or vsnprintf(), then there is 228 hand, if zlib is compiled to use snprintf() or vsnprintf(), which should
207 no vulnerability. 229 normally be the case, then there is no vulnerability. The ./configure
230 script will display warnings if an insecure variation of sprintf() will
231 be used by gzprintf().
232
233 If you don't have snprintf() or vsnprintf() and would like one, you can
234 find a portable implementation here:
235
236 http://www.ijs.si/software/snprintf/
208 237
209 Note that you should be using the most recent version of zlib. Versions 238 Note that you should be using the most recent version of zlib. Versions
210 1.1.3 and before were subject to a double-free vulnerability. 239 1.1.3 and before were subject to a double-free vulnerability.
211 240
21231. Is there a Java version of zlib? 24132. Is there a Java version of zlib?
213 242
214 Probably what you want is to use zlib in Java. zlib is already included 243 Probably what you want is to use zlib in Java. zlib is already included
215 as part of the Java SDK in the java.util.zip class. If you really want 244 as part of the Java SDK in the java.util.zip class. If you really want
216 a version of zlib written in the Java language, look on the zlib home 245 a version of zlib written in the Java language, look on the zlib home
217 page for links: http://www.zlib.org/ 246 page for links: http://www.zlib.org/
218 247
21932. I get this or that compiler or source-code scanner warning. Can't you guys 24833. I get this or that compiler or source-code scanner warning when I crank it
220 write proper code? 249 up to maximally-pendantic. Can't you guys write proper code?
221 250
222 Many years ago, we gave up attempting to avoid warnings on every compiler 251 Many years ago, we gave up attempting to avoid warnings on every compiler
223 in the universe. It just got to be a waste of time, and some compilers 252 in the universe. It just got to be a waste of time, and some compilers
224 were downright silly. So now, we simply make sure that the code always 253 were downright silly. So now, we simply make sure that the code always
225 works. 254 works.
226 255
22733. Will zlib read the (insert any ancient or arcane format here) compressed 25634. Will zlib read the (insert any ancient or arcane format here) compressed
228 data format? 257 data format?
229 258
230 Probably not. Look in the comp.compression FAQ for pointers to various 259 Probably not. Look in the comp.compression FAQ for pointers to various
231 formats and associated software. 260 formats and associated software.
232 261
23334. How can I encrypt/decrypt zip files with zlib? 26235. How can I encrypt/decrypt zip files with zlib?
234 263
235 zlib doesn't support encryption. PKZIP encryption is very weak and can be 264 zlib doesn't support encryption. PKZIP encryption is very weak and can be
236 broken with freely available programs. To get strong encryption, use gpg 265 broken with freely available programs. To get strong encryption, use gpg
237 which already includes zlib compression. 266 which already includes zlib compression.
238 267
23935. What's the difference between the "gzip" and "deflate" HTTP 1.1 encodings? 26836. What's the difference between the "gzip" and "deflate" HTTP 1.1 encodings?
240 269
241 "gzip" is the gzip format, and "deflate" is the zlib format. They should 270 "gzip" is the gzip format, and "deflate" is the zlib format. They should
242 probably have called the second one "zlib" instead to avoid confusion 271 probably have called the second one "zlib" instead to avoid confusion
@@ -250,14 +279,14 @@ The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html
250 for), using the "gzip" transfer encoding is probably more reliable due to 279 for), using the "gzip" transfer encoding is probably more reliable due to
251 an unfortunate choice of name on the part of the HTTP 1.1 authors. 280 an unfortunate choice of name on the part of the HTTP 1.1 authors.
252 281
25336. Does zlib support the new "Deflate64" format introduced by PKWare? 28237. Does zlib support the new "Deflate64" format introduced by PKWare?
254 283
255 No. PKWare has apparently decided to keep that format proprietary, since 284 No. PKWare has apparently decided to keep that format proprietary, since
256 they have not documented it as they have previous compression formats. 285 they have not documented it as they have previous compression formats.
257 In any case, the compression improvements are so modest compared to other 286 In any case, the compression improvements are so modest compared to other
258 more modern approaches, that it's not worth the effort to implement. 287 more modern approaches, that it's not worth the effort to implement.
259 288
26037. Can you please sign these lengthy legal documents and fax them back to us 28938. Can you please sign these lengthy legal documents and fax them back to us
261 so that we can use your software in our product? 290 so that we can use your software in our product?
262 291
263 No. 292 No. Go away.