Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6791502
Votes 0
Synopsis IIOException "Invalid icc profile" on jpeg after update from JDK5 to JDK6
Category java:imageio
Reported Against
Release Fixed 7(b54), 6u14(b04) (Bug ID:2174195)
State 10-Fix Delivered, bug
Priority: 3-Medium
Related Bugs
Submit Date 08-JAN-2009
Description
FULL PRODUCT VERSION :
java version "1.6.0_07"
Java(TM) SE Runtime Environment (build 1.6.0_07-b06)
Java HotSpot(TM) Client VM (build 10.0-b23, mixed mode, sharing)
---
java version "1.6.0_07"
Java(TM) SE Runtime Environment (build 1.6.0_07-b06)
Java HotSpot(TM) 64-Bit Server VM (build 10.0-b23, mixed mode)


ADDITIONAL OS VERSION INFORMATION :
 customer  Windows XP SP3 [Version 5.1.2600]
---
Linux 2.6.18.7-em64t SMP x86_64 GNU/Linux


A DESCRIPTION OF THE PROBLEM :
When reading a JPEG-File, an IIOException is thrown. The file can be opened by other applications, in browsers and can be read by Java when using an older JDK5:

java version "1.5.0_08"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_08-b03)
Java HotSpot(TM) Server VM (build 1.5.0_08-b03, mixed mode)

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
ImageIO.read(new File("C:\\4250252101840_b24a3a71d3116db3eead8c20753ea629.jpg"));

The file which produces the error can be provided upon request.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
BufferedImage is created.
ACTUAL -
IIOException is thrown.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
javax.imageio.IIOException: Invalid icc profile: bad sequence number
	at com.sun.imageio.plugins.jpeg.JPEGImageReader.readImageHeader(Native Method)
	at com.sun.imageio.plugins.jpeg.JPEGImageReader.readNativeHeader(JPEGImageReader.java:560)
	at com.sun.imageio.plugins.jpeg.JPEGImageReader.checkTablesOnly(JPEGImageReader.java:315)
	at com.sun.imageio.plugins.jpeg.JPEGImageReader.gotoImage(JPEGImageReader.java:437)
	at com.sun.imageio.plugins.jpeg.JPEGImageReader.readHeader(JPEGImageReader.java:553)
	at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:931)
	at com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEGImageReader.java:915)
	at javax.imageio.ImageReader.read(ImageReader.java:923)


REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
public static void main(String args[]) {
	try {
		ImageIO.read(new File("C:\\4250252101840_b24a3a71d3116db3eead8c20753ea629.jpg"));
	} catch (IOException e) {
		e.printStackTrace();
	}
}

---------- END SOURCE ----------

Release Regression From : 5
The above release value was the last known release where this 
bug was not reproducible. Since then there has been a regression.
Posted Date : 2009-01-08 14:29:41.0
Work Around
N/A
Evaluation
This problem (icc profile reading failure) was present in 5.0 and former releases
but was masqueraded by extra JNI calls (made by RELEASE_ARRAY).
Note that  -Xcheck:jni flag makes this problem visible in 5.0:

C:\work\bugs\6791502>5.0u17\windows-i586\jre\bin\java -Xcheck:jni Test test.jpg
Test file: test.jpg
Warning: Calling other JNI functions in the scope of Get/ReleasePrimitiveArrayCritical or Get/ReleaseStringCritical
Warning: Calling other JNI functions in the scope of Get/ReleasePrimitiveArrayCritical or Get/ReleaseStringCritical
Warning: Calling other JNI functions in the scope of Get/ReleasePrimitiveArrayCritical or Get/ReleaseStringCritical
FATAL ERROR in native method: JNI call made with exception pending
        at com.sun.imageio.plugins.jpeg.JPEGImageReader.readImageHeader(Native Method)
        at com.sun.imageio.plugins.jpeg.JPEGImageReader.readNativeHeader(JPEGImageReader.java:554)
        at com.sun.imageio.plugins.jpeg.JPEGImageReader.checkTablesOnly(JPEGImageReader.java:309)
        at com.sun.imageio.plugins.jpeg.JPEGImageReader.gotoImage(JPEGImageReader.java:431)
        at com.sun.imageio.plugins.jpeg.JPEGImageReader.readHeader(JPEGImageReader.java:547)
        at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:880)
        at com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEGImageReader.java:864)
        at javax.imageio.ImageIO.read(ImageIO.java:1400)
        at javax.imageio.ImageIO.read(ImageIO.java:1286)
        at Test.main(Test.java:13)

The fix for CR 4528643 (6.0b83) made this problem more visible: after this fix the IIOEXception
  which was thrown by read_icc_profile is not consumed anymore and this is reason of observed
  change in the reader behavior.

So, there are two separate problems:

1) Method read_icc_profile() may throw an IIOException if there are some problem
     with profile chunks (wrong numeration or missed chunks, for example). We should
     handle this exception before performing invocation of setImageData() in order to
     avoid the JNI state corruption.

2) In particular case of given image we should be more tolerant to incorrect profile
    chunks numeration: in case of single chunk we probably can ignore incorrect chunk
    number without any risk.
Posted Date : 2009-01-29 14:48:01.0
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang