FULL PRODUCT VERSION :
java version "1.6.0_02"
Java(TM) SE Runtime Environment (build 1.6.0_02-b06)
Java HotSpot(TM) Client VM (build 1.6.0_02-b06, mixed mode, sharing)
java version "1.6.0_03"
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode)
FULL OS VERSION :
Microsoft Windows XP [Version 5.1.2600]
EXTRA RELEVANT SYSTEM CONFIGURATION :
Java is installed to C:\java\jdk1.6.0_02
While I ran this under Cygwin, running with the Windows command prompt produces the same error.
A DESCRIPTION OF THE PROBLEM :
Sorry for the duplicate report; my email address in the previous one did not work.
Running the attached code with a greyscale .png with an alpha channel crashes the VM. What I'm doing probably isn't right though, but something besides a crash would help. I tested a few other images, and an RGB image with no alpha channel also causes this. Changing the image size doesn't help.
Attaching some images which I created with Gimp to demonstrate the
problem, with several combinations of depth and alpha:
test1.png: PNG image data, 16 x 16, 8-bit/color RGB, non-interlaced
test2.png: PNG image data, 16 x 16, 8-bit gray+alpha, non-interlaced
test3.png: PNG image data, 16 x 16, 8-bit/color RGBA, non-interlaced
All three images caused the crash.
THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Yes
THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Yes
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
- Create a .png image, 16x16 pixels, save as test1.png.
- Build the attached code, put the .class in the same directory as the .png, run it.
EXPECTED VERSUS ACTUAL BEHAVIOR :
Actual:
#
# An unexpected error has been detected by Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6d15d9d5, pid=3780, tid=1072
#
# Java VM: Java HotSpot(TM) Client VM (1.6.0_02-b06 mixed mode, sharing)
# Problematic frame:
# C [awt.dll+0xad9d5]
#
# An error report file with more information is saved as hs_err_pid3780.log
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
#
Expected:
Presumably not a crash
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Attached seperatly
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.image.*;
import java.awt.color.*;
import javax.imageio.*;
import java.io.*;
import java.awt.*;
public class Test {
private byte[][] getLookupTableFor(Color c)
{
byte[][] table = new byte[3][256];
float[] rgb = c.getRGBColorComponents(null);
for (int i = 0; i < 256; i++) {
for (int b = 0; b < 3; b++)
table[b][i] = (byte) (i * rgb[b]);
}
return table;
}
private void colourImage(BufferedImage image, Color tint)
{
// make sure the image is in the right colour space first
ColorConvertOp cop = new ColorConvertOp(ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB), null);
BufferedImage newImage = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_INT_ARGB);
LookupOp op = new LookupOp(new ByteLookupTable(0, getLookupTableFor(tint)), null);
op.filter(newImage, newImage);
}
public static void main (String[] args) throws IOException {
new Test();
}
public Test() throws IOException {
BufferedImage i = ImageIO.read(new File("test1.png").toURI().toURL());
colourImage(i, Color.GREEN);
}
}
---------- END SOURCE ----------