-
Bug
-
Resolution: Unresolved
-
P4
-
None
-
1.4.0, 5.0
-
None
-
x86, sparc
-
solaris_8, windows_xp
Start the program below with the attached .jpg file as input and any name as output. The VM will crash. The log of crash attached. Problem reproducible on
JDK 1.4.0, 1.4.2 and current sources.
import javax.imageio.*;
import java.awt.*;
import java.awt.image.*;
import java.awt.color.ColorSpace;
import java.io.*;
import java.util.*;
public class ImageInvertor
{
public static void main( String[] args )
throws IOException
{
if ( args.length != 2 ) {
System.out.println( "Usage is: ImageInvertor <inFile.jpg> <outFile.jpg>" );
return;
}
long startTime = System.currentTimeMillis();
String inFileName = args[0];
System.out.println(inFileName);
String outFileName = args[1];
// read
BufferedImage img = ImageIO.read( new BufferedInputStream( new FileInputStream( inFileName ) ) );
if ( img == null )
throw new IOException( "File format is unknown" );
BufferedImage oimg =
new BufferedImage( img.getWidth(), img.getHeight(), BufferedImage.TYPE_INT_RGB );
byte invert[] = new byte[256];
for (int j = 0; j < 256 ; j++) {
invert[j] = (byte) (256-j);
}
LookupOp lop = new LookupOp( new ByteLookupTable( 0, invert ), null );
lop.filter( img, oimg );
// write
OutputStream out = new BufferedOutputStream( new FileOutputStream( outFileName ) );
try {
ImageIO.write( oimg, "JPEG", out );
}
finally {
out.close();
}
System.out.println( "Time consumed: " + ( System.currentTimeMillis() - startTime ) + "ms" );
}
}
JDK 1.4.0, 1.4.2 and current sources.
import javax.imageio.*;
import java.awt.*;
import java.awt.image.*;
import java.awt.color.ColorSpace;
import java.io.*;
import java.util.*;
public class ImageInvertor
{
public static void main( String[] args )
throws IOException
{
if ( args.length != 2 ) {
System.out.println( "Usage is: ImageInvertor <inFile.jpg> <outFile.jpg>" );
return;
}
long startTime = System.currentTimeMillis();
String inFileName = args[0];
System.out.println(inFileName);
String outFileName = args[1];
// read
BufferedImage img = ImageIO.read( new BufferedInputStream( new FileInputStream( inFileName ) ) );
if ( img == null )
throw new IOException( "File format is unknown" );
BufferedImage oimg =
new BufferedImage( img.getWidth(), img.getHeight(), BufferedImage.TYPE_INT_RGB );
byte invert[] = new byte[256];
for (int j = 0; j < 256 ; j++) {
invert[j] = (byte) (256-j);
}
LookupOp lop = new LookupOp( new ByteLookupTable( 0, invert ), null );
lop.filter( img, oimg );
// write
OutputStream out = new BufferedOutputStream( new FileOutputStream( outFileName ) );
try {
ImageIO.write( oimg, "JPEG", out );
}
finally {
out.close();
}
System.out.println( "Time consumed: " + ( System.currentTimeMillis() - startTime ) + "ms" );
}
}
- duplicates
-
JDK-6450538 Crash when applying LookupOp on color indexed image
-
- Closed
-