Created attachment 470417 [details] source code reproducing the issue Description of problem: Fedora java distribution cannot read some PNG images which work fine in * Windows java 1.6 * Linux image viewers * browsers * "identify a.png" works: PNG 16x16 16x16+0+0 8-bit DirectClass 1.38KB 0.000u 0:00.000 Steps to Reproduce: See attached. javac PngMain.java java PngMain Actual results: 1.6.0_20 19.0-b09 Sun Microsystems Inc. Linux 2.6.35.9-64.fc14.x86_64 DEBUG it javax.imageio.ImageIO$ImageReaderIterator@3ced0338 DEBUG reader com.sun.imageio.plugins.png.PNGImageReader@2e8f4fb3 com.sun.imageio.plugins.png.PNGImageReaderSpi@b815859 DEBUG numImages 1 Exception in thread "main" javax.imageio.IIOException: Error reading PNG metadata at com.sun.imageio.plugins.png.PNGImageReader.readMetadata(PNGImageReader.java:761) at com.sun.imageio.plugins.png.PNGImageReader.readImage(PNGImageReader.java:1221) at com.sun.imageio.plugins.png.PNGImageReader.read(PNGImageReader.java:1552) at javax.imageio.ImageReader.read(ImageReader.java:940) at PngMain.main(PngMain.java:38) Caused by: java.io.EOFException at javax.imageio.stream.ImageInputStreamImpl.readFully(ImageInputStreamImpl.java:353) at java.io.DataInputStream.readUTF(DataInputStream.java:609) at javax.imageio.stream.ImageInputStreamImpl.readUTF(ImageInputStreamImpl.java:332) at com.sun.imageio.plugins.png.PNGImageReader.parse_iTXt_chunk(PNGImageReader.java:469) at com.sun.imageio.plugins.png.PNGImageReader.readMetadata(PNGImageReader.java:709) Expected results: Replacing a.png with b.png works
The tested image contains iTXt chunk where is stored XML structure generated by Adobe Image Ready. This chunk contains following data: Keyword: "XML:com.adobe.xmp" (ok) Null separator: \0 (ok) Text: "<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?> <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.0-c060 61.134777, 2010/02/12-17:32:00 "> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <rdf:Description rdf:about="" xmlns:xmp="http://ns.adobe.com/xap/1.0/" xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/" xmlns:stRef="http://ns.adobe.com/xap/1.0/sType/ResourceRef#" xmp:CreatorTool="Adobe Photoshop CS5 Windows" xmpMM:InstanceID="xmp.iid:1C70A6E0FE2911DF8798D62C9C3F97B1" xmpMM:DocumentID="xmp.did:1C70A6E1FE2911DF8798D62C9C3F97B1"> <xmpMM:DerivedFrom stRef:instanceID="xmp.iid:1C70A6DEFE2911DF8798D62C9C3F97B1" stRef:documentID="xmp.did:1C70A6DFFE2911DF8798D62C9C3F97B1"/> </rdf:Description> </rdf:RDF> </x:xmpmeta> <?xpacket end="r"?>" Please note please that the text mentioned above uses non-ASCII characters stored in XML attribute "begin" which is handled incorrectly in JDK6 (6541476 in the Oracle bug database). AFAIK Deepak is working on backporting correction from JDK7.
2 Deepak: your patch really fixes this issue.
*** Bug 665336 has been marked as a duplicate of this bug. ***
java-1.6.0-openjdk-1.6.0.0-51.1.9.5.fc14 has been submitted as an update for Fedora 14. https://admin.fedoraproject.org/updates/java-1.6.0-openjdk-1.6.0.0-51.1.9.5.fc14
java-1.6.0-openjdk-1.6.0.0-49.1.8.5.fc13 has been submitted as an update for Fedora 13. https://admin.fedoraproject.org/updates/java-1.6.0-openjdk-1.6.0.0-49.1.8.5.fc13
java-1.6.0-openjdk-1.6.0.0-49.1.8.5.fc13 has been pushed to the Fedora 13 testing repository. If problems still persist, please make note of it in this bug report. If you want to test the update, you can install it with su -c 'yum --enablerepo=updates-testing update java-1.6.0-openjdk'. You can provide feedback for this update here: https://admin.fedoraproject.org/updates/java-1.6.0-openjdk-1.6.0.0-49.1.8.5.fc13
java-1.6.0-openjdk-1.6.0.0-49.1.8.5.fc13 has been pushed to the Fedora 13 stable repository. If problems still persist, please make note of it in this bug report.
java-1.6.0-openjdk-1.6.0.0-51.1.9.5.fc14 has been pushed to the Fedora 14 stable repository. If problems still persist, please make note of it in this bug report.