From: Robert A. <bob...@ed...> - 2007-11-28 19:20:14
|
On Tue, 2007-11-27 at 22:24 +0200, Janne Hellsten wrote: > I applied your patch for the write_i16 but I didn't apply the Unzip fix yet. > > I also added both the Unzip and IO test cases into the test suite > (/cvsroot/ocaml-lib/extlib-test). Applying your second unzip change > to extlib-dev does make the test case pass. > > Rob, how extensively have you tested your Unzip change? I'm not > doubting that your change wouldn't work, I just don't have any test > coverage to support your case. :( I have tested the modified Unzip module against the rt.jar files from several versions of the Sun JVM, plus assorted other jar files, and it seems to work. It is interesting that in all of these files, the only uncompressed block that triggers the bug was in the file sun/util/resources/TimeZoneNames_fr.class in the jre/lib/rt.jar file of Sun's JVM version 1.6.0.01. I've made the test case a little more convincing now by taking the output of zlib and using that as the test data (there was a harmless mistake in the test data I gave previously: the order of the bits in the first byte was switched). The new test case is: let test_unzip_bug1 () = let test data = let input = IO.input_string data in let unzipped = Unzip.inflate input in try let str = IO.read_all unzipped in assert (str = "XY") with Unzip.Error Unzip.Invalid_data -> assert false in (* this is "XY" compressed by zlib at level 9 *) test "\x78\xda\x8b\x88\x04\x00\x01\x0b\x00\xb2"; (* this is "XY" compressed by zlib at level 0 *) test "\x78\x01\x01\x02\x00\xfd\xff\x58\x59\x01\x0b\x00\xb2" The unmodified Unzip is OK on the first one, but fails on the second. The modified Unzip succeeds on both. I've attached the C program I used to generate the test data. I guess a whole range of test data could be generated to test the Unzip module. Bob |