[xml] gzdirect() doesn't work in zlib 1.3.5.5 (at least) (was Re: libxml violates the zlib interface and crashes)



On 20 Jan 2010, Mark Adler stated:

On Jan 19, 2010, at 7:30 AM, Daniel Veillard wrote:
Since the old cod is the same it should be safe too so I'm pushing that patch.

Daniel,

Excellent, thanks!  I get the impression that it is common to read xml
from an http server with gzip compression.  So if zlib is updated and
libxml is not, this should be detected pretty quickly and diagnosed
easily, resulting in libxml being updated.  In fact, maybe this is
sneaky sort of benefit to libxml that encourages users to get the
latest version.

Yep! And then we upgrade to 1.2.3.5, and 'make check' hits us with this:

## XML regression tests
File ./test/att1 generated an error
File ./test/att10 generated an error
File ./test/att11 generated an error
File ./test/att2 generated an error
File ./test/att3 generated an error
File ./test/att4 generated an error
File ./test/att5 generated an error
File ./test/att6 generated an error
File ./test/att7 generated an error
File ./test/att8 generated an error
File ./test/att9 generated an error
[...]

The failures are in the xmlSaveFile() roundtrip tests in oldParseTest()
(and probably noentParseTest() as well). xmlSaveFile is documented as
saving the file gzipped if compression is compiled in... but the result
files being compared against are not compressed, so if compression is
compiled in, the test fails.

i.e., it looks like xmlDoc->compressed is always TRUE, even if the
input file was not compressed. Oops.

This is apparently a zlib bug. With appropriate instrumentation, we
see:

spindle 449 /usr/src/gnome/x86_64-spindle% LD_LIBRARY_PATH=/pkg/zlib/1.2.3.5/lib ./runtest 2>&1 | head -20
ret->compressed: 1
ret->compressed: 1
File ./test/att1 generated an error
ret->compressed: 1
ret->compressed: 1
File ./test/att10 generated an error
ret->compressed: 1
ret->compressed: 1
File ./test/att11 generated an error
ret->compressed: 1
ret->compressed: 1
File ./test/att2 generated an error

Yet:

spindle 450 /usr/src/gnome/x86_64-spindle% LD_LIBRARY_PATH=/pkg/zlib/1.2.3.3/lib ./runtest 2>&1 | head -20
ret->compressed: 0
ret->compressed: 0
ret->compressed: 0
ret->compressed: 0
ret->compressed: 0
ret->compressed: 0
ret->compressed: 0
ret->compressed: 0
ret->compressed: 0
ret->compressed: 0
ret->compressed: 0
ret->compressed: 0
ret->compressed: 0
ret->compressed: 0
ret->compressed: 0
ret->compressed: 0
ret->compressed: 0

These results are inverted, so in 1.2.3.5, gzdirect() returns 0 even
when the input source file is not compressed at all. Oops?



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]