From: John L. <je...@pi...> - 2003-08-20 14:37:43
|
Hello Eric Thanks for finding these bugs and suggesting solutions. I will apply these patches and make a new release of jazzlib soon, but first I would like to create a test case that exposes this bug. Could you send me a small zip file (and perhaps a few lines of Java code) that I can use as a test case for this? Thanks John Leuner On Fri, 2003-08-15 at 21:42, Eric Lee wrote: > Hi Jazzlib developers, >=20 > =20 >=20 > Thanks for providing this open source project to the Java > community. I have found a couple bugs in jazzlib regarding to the > DBCS (Double-byte character set, eg. Chinese) paths and file names. >=20 > =20 >=20 > 1) >=20 > =20 >=20 > In file ZipFile.java, inside method checkLocalHeader >=20 > =20 >=20 > if (entry.getName().length() !=3D readLeShort(locBuf, > LOCNAM)) >=20 > throw new ZipException("file name length mismatch: " + > name); >=20 > =20 >=20 > The if statement is wrong, and it should be >=20 > =20 >=20 > if (entry.getName().getBytes(),length !=3D > readLeShort(locBuf, LOCNAM)) >=20 > throw new ZipException("file name length mismatch: " + > name); >=20 > =20 >=20 > We should use the number of bytes rather than the number of characters > as they are not the same for DBCS. >=20 > =20 >=20 > 2. >=20 > =20 >=20 > In file ZipFile, inside method readEntries >=20 > =20 >=20 > String name =3D new String(buffer, 0, 0, nameLen); >=20 > =20 >=20 > We shouldn't use this constructor because it is deprecated and it is > not correct for DBCS. This should be changed to... >=20 > =20 >=20 > String name =3D new String(buffer, 0, nameLen); >=20 > =20 >=20 > =20 >=20 > If these are the right ways to go, I hope these bugs could > be fixed in the next version. Please let me know if you need more > information from me. Thanks. >=20 > =20 >=20 > Regards, >=20 > =20 >=20 > Eric Lee >=20 > =20 >=20 > Micro Focus (Sunnyvale) >=20 > Email: Eri...@mi... >=20 > Phone number: (408) 222-0358 >=20 > =20 --=20 John Leuner <je...@pi...> |