Bug 665355

Summary: IIOException: Error reading PNG metadata
Product: [Fedora] Fedora Reporter: Marius Andreiana <marius.andreiana>
Component: java-1.6.0-openjdkAssignee: Deepak Bhole <dbhole>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 14CC: ahughes, dbhole, jvanek, langel, lkundrak, mjw, mmatejov, omajid, ptisnovs, srinivas_g_gowda
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Fixed In Version: java-1.6.0-openjdk- Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-02-02 14:34:49 EST Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Description Flags
source code reproducing the issue none

Description Marius Andreiana 2010-12-23 06:59:07 EST
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:
Sun Microsystems Inc.
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
Comment 1 Pavel Tisnovsky 2011-01-03 09:28:43 EST
The tested image contains iTXt chunk where is stored XML structure generated by Adobe Image Ready. This chunk contains following data:

"XML:com.adobe.xmp" (ok)

Null separator:
\0 (ok)

"<?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.
Comment 2 Pavel Tisnovsky 2011-01-03 11:07:42 EST
2 Deepak: your patch really fixes this issue.
Comment 3 Prarit Bhargava 2011-01-07 10:17:47 EST
*** Bug 665336 has been marked as a duplicate of this bug. ***
Comment 4 Fedora Update System 2011-02-01 10:38:35 EST
java-1.6.0-openjdk- has been submitted as an update for Fedora 14.
Comment 5 Fedora Update System 2011-02-01 10:40:43 EST
java-1.6.0-openjdk- has been submitted as an update for Fedora 13.
Comment 6 Fedora Update System 2011-02-01 15:52:49 EST
java-1.6.0-openjdk- 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-
Comment 7 Fedora Update System 2011-02-02 14:34:35 EST
java-1.6.0-openjdk- has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 8 Fedora Update System 2011-02-02 14:37:23 EST
java-1.6.0-openjdk- has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.