[Zlib-devel] gzip streams instead of zlib streams
Cosmin Truta
cosmin at cs.toronto.edu
Mon Apr 21 18:00:02 EDT 2003
Hi,
I remember Mark said some time ago he enabled zlib to recognize and read
gzip streams even when zlib streams are expected. The reason was that he
got tired of answering illegitimate "bug reports" claiming that zlib
doesn't work on gzip streams.
Now there is another problem: zlib-based file formats cannot be
validated. I created an artificial PNG whose IDAT was containing a gzip
stream. The result: (as expected) that invalid PNG was not shown at all
by some programs, shown as garbage by others, BUT was accepted without
any comment by my PNG-processing software that I use to test zlib-1.2.x.
There are two possible scenarios:
1. Let zlib handle gzip streams even when zlib streams are expected, but
issue a warning.
2. When a gzip stream is being used instead of a zlib stream, issue a
more descriptive error message, such as:
"zlib stream expected; gzip stream illegally used"
with a proper explanation in the docs and FAQ.
If these unfounded "bug reports" are the only reason why zlib is now
more lenient, then I think that scenario #2 can fix the problem well
enough. The big downside of scenario #1 is that the zlib-based file
formats are invalid if the contained zlib streams are replaced with
gzip streams. (There may be exceptions, but I don't think it matters.)
Even though zlib-1.2.x is not more helpful to writing bad software than
the previous versions, it may cause the testers fail to notice invalid
(PNG, MNG, PDF, ...) streams, or bad encoders.
Cosmin
More information about the Zlib-devel
mailing list