On 13 July 2010 13:53, Jeroen Frijters <jer...@sumatra.nl> wrote: > Hello, > > I've committed the patch below and closed the bug. >
Thanks. I couldn't include the whole of Daniel's patch as he hasn't signed a copyright assignment. > Regards, > Jeroen > > Index: InflaterHuffmanTree.java > =================================================================== > RCS file: > /cvsroot/classpath/classpath/java/util/zip/InflaterHuffmanTree.java,v > retrieving revision 1.7 > diff -u -r1.7 InflaterHuffmanTree.java > --- InflaterHuffmanTree.java 3 Jun 2010 19:13:21 -0000 1.7 > +++ InflaterHuffmanTree.java 13 Jul 2010 12:42:57 -0000 > @@ -95,11 +95,14 @@ > blCount[bits]++; > } > > + int max = 0; > int code = 0; > int treeSize = 512; > for (int bits = 1; bits <= MAX_BITLEN; bits++) > { > nextCode[bits] = code; > + if (blCount[bits] > 0) > + max = bits; > code += blCount[bits] << (16 - bits); > if (bits >= 10) > { > @@ -109,8 +112,8 @@ > treeSize += (end - start) >> (16 - bits); > } > } > - if (code != 65536) > - throw new DataFormatException("Code lengths don't add up properly."); > + if (code != 65536 && max != 1) > + throw new DataFormatException("incomplete dynamic bit lengths tree"); > > /* Now create and fill the extra tables from longest to shortest > * bit len. This way the sub trees will be aligned. > > >> -----Original Message----- >> From: classpath-patches-boun...@gnu.org [mailto:classpath-patches- >> boun...@gnu.org] On Behalf Of Ivan Maidanski >> Sent: Monday, June 28, 2010 9:41 AM >> To: classpath-patches >> Cc: Daniel Noll; Andrew John Hughes >> Subject: [cp-patches] What's about bug 36560 (Error parsing zip >> file...)? >> >> Hello! >> >> Andrew - >> could you apply the proposed patch >> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18682&action=view) and >> close bug 36560? >> >> I can't immediately propose the test case for this bug but I've >> discovered this issue when tried to use Classpath >> Inflater/InflaterInputStream with OpenJDK PNGImageReader - on some >> legacy .png files a ZipException("Code lengths don't add up properly") >> was thrown while OpenJDK Inflater (based on zlib) worked correctly. The >> patch proposed by Daniel Noll solved my problem. >> >> Regards. > > > -- Andrew :-) Free Java Software Engineer Red Hat, Inc. (http://www.redhat.com) Support Free Java! Contribute to GNU Classpath and the OpenJDK http://www.gnu.org/software/classpath http://openjdk.java.net PGP Key: 94EFD9D8 (http://subkeys.pgp.net) Fingerprint: F8EF F1EA 401E 2E60 15FA 7927 142C 2591 94EF D9D8